Merge pull request #4012 from halseth/mpp-paymentid-error
[trivial] channeldb: remove unused payments status serialization
This commit is contained in:
commit
3da5ca0bd2
@ -3,7 +3,6 @@ package channeldb
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"sort"
|
"sort"
|
||||||
@ -154,27 +153,6 @@ const (
|
|||||||
StatusFailed PaymentStatus = 3
|
StatusFailed PaymentStatus = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
// Bytes returns status as slice of bytes.
|
|
||||||
func (ps PaymentStatus) Bytes() []byte {
|
|
||||||
return []byte{byte(ps)}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FromBytes sets status from slice of bytes.
|
|
||||||
func (ps *PaymentStatus) FromBytes(status []byte) error {
|
|
||||||
if len(status) != 1 {
|
|
||||||
return errors.New("payment status is empty")
|
|
||||||
}
|
|
||||||
|
|
||||||
switch PaymentStatus(status[0]) {
|
|
||||||
case StatusUnknown, StatusInFlight, StatusSucceeded, StatusFailed:
|
|
||||||
*ps = PaymentStatus(status[0])
|
|
||||||
default:
|
|
||||||
return errors.New("unknown payment status")
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// String returns readable representation of payment status.
|
// String returns readable representation of payment status.
|
||||||
func (ps PaymentStatus) String() string {
|
func (ps PaymentStatus) String() string {
|
||||||
switch ps {
|
switch ps {
|
||||||
|
Loading…
Reference in New Issue
Block a user