channeldb: Fix dropped error in migrations test

channeldb: Fix dropped error and wrap with context

channeldb: Fix empty error condition in waitingproof test

channeldb: Fix empty error condition in codec

channeldb: Wrap error in context
This commit is contained in:
Lars Lehtonen 2019-09-12 13:49:11 +00:00
parent e61ec3a46d
commit 2f51ccd10b
4 changed files with 8 additions and 1 deletions

@ -76,6 +76,7 @@ func WriteElement(w io.Writer, element interface{}) error {
if e.PubKey != nil {
if err := binary.Write(w, byteOrder, true); err != nil {
return fmt.Errorf("error writing serialized element: %s", err)
}
return WriteElement(w, e.PubKey)

@ -515,6 +515,9 @@ func migratePruneEdgeUpdateIndex(tx *bbolt.Tx) error {
// already exist given the assumption that the buckets above do as
// well.
edgeIndex, err := edges.CreateBucketIfNotExists(edgeIndexBucket)
if err != nil {
return fmt.Errorf("error creating edge index bucket: %s", err)
}
if edgeIndex == nil {
return fmt.Errorf("unable to create/fetch edge index " +
"bucket")

@ -839,6 +839,9 @@ func TestPaymentRouteSerialization(t *testing.T) {
payHashBucket, err = paymentsBucket.CreateBucket(
payInfo.PaymentHash[:],
)
if err != nil {
t.Fatalf("unable to create payments bucket: %v", err)
}
} else {
payHashBucket = paymentsBucket.Bucket(
payInfo.PaymentHash[:],

@ -16,7 +16,7 @@ func TestWaitingProofStore(t *testing.T) {
db, cleanup, err := makeTestDB()
if err != nil {
t.Fatalf("failed to make test database: %s", err)
}
defer cleanup()