Skip to content

Commit

Permalink
Merge pull request #4012 from halseth/mpp-paymentid-error
Browse files Browse the repository at this point in the history
[trivial] channeldb: remove unused payments status serialization
  • Loading branch information
halseth authored Feb 18, 2020
2 parents 3e9087a + cdf3a49 commit 3da5ca0
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions channeldb/payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package channeldb
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"io"
"sort"
Expand Down Expand Up @@ -154,27 +153,6 @@ const (
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.
func (ps PaymentStatus) String() string {
switch ps {
Expand Down

0 comments on commit 3da5ca0

Please sign in to comment.