From 2f51ccd10bf8494cd047357803d24f9627f521fd Mon Sep 17 00:00:00 2001 From: Lars Lehtonen Date: Thu, 12 Sep 2019 13:49:11 +0000 Subject: [PATCH] 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 --- channeldb/codec.go | 1 + channeldb/migrations.go | 3 +++ channeldb/migrations_test.go | 3 +++ channeldb/waitingproof_test.go | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/channeldb/codec.go b/channeldb/codec.go index e693739b..78d61694 100644 --- a/channeldb/codec.go +++ b/channeldb/codec.go @@ -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) diff --git a/channeldb/migrations.go b/channeldb/migrations.go index e009d833..a78d1314 100644 --- a/channeldb/migrations.go +++ b/channeldb/migrations.go @@ -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") diff --git a/channeldb/migrations_test.go b/channeldb/migrations_test.go index 3627f142..93bf602f 100644 --- a/channeldb/migrations_test.go +++ b/channeldb/migrations_test.go @@ -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[:], diff --git a/channeldb/waitingproof_test.go b/channeldb/waitingproof_test.go index 2f8a64b0..fff52b92 100644 --- a/channeldb/waitingproof_test.go +++ b/channeldb/waitingproof_test.go @@ -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()