Skip to content

Commit c932ae4

Browse files
authored
Merge pull request #254 from ErikEk/missing-key-error
Headerfs: add error msg
2 parents afcfeb1 + 1474e20 commit c932ae4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

headerfs/index.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@ func (h *headerIndex) chainTipWithTx(tx walletdb.ReadTx) (*chainhash.Hash,
266266
// fetch the hash for this tip, then using that we'll fetch the height
267267
// that corresponds to that hash.
268268
tipHashBytes := rootBucket.Get(tipKey)
269+
if tipHashBytes == nil {
270+
return nil, 0, fmt.Errorf(
271+
"the key %s does not exist in bucket %s",
272+
tipKey, indexBucket,
273+
)
274+
}
269275
tipHeight, err := getHeaderEntry(rootBucket, tipHashBytes)
270276
if err != nil {
271277
return nil, 0, ErrHeightNotFound

0 commit comments

Comments
 (0)