Skip to content

Commit

Permalink
Fix log warnings (== should have been !=) (#2907)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjfh authored Dec 4, 2024
1 parent 1101895 commit 1d70ba5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions nimbus/db/core_db/core_apps.nim
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ proc getUnclesCount*(
let encodedUncles = block:
let key = genericHashKey(ommersHash)
db.ctx.getKvt().get(key.toOpenArray).valueOr:
if error.error == KvtNotFound:
if error.error != KvtNotFound:
warn info, ommersHash, error=($$error)
return ok(0)
return ok(rlpFromBytes(encodedUncles).listLen)
Expand All @@ -372,7 +372,7 @@ proc getUncles*(
let encodedUncles = block:
let key = genericHashKey(ommersHash)
db.ctx.getKvt().get(key.toOpenArray).valueOr:
if error.error == KvtNotFound:
if error.error != KvtNotFound:
warn info, ommersHash, error=($$error)
return ok(default(seq[Header]))
return ok(rlp.decode(encodedUncles, seq[Header]))
Expand Down Expand Up @@ -474,7 +474,7 @@ proc getUncleHashes*(
let
key = genericHashKey(header.ommersHash)
encodedUncles = db.ctx.getKvt().get(key.toOpenArray).valueOr:
if error.error == KvtNotFound:
if error.error != KvtNotFound:
warn "getUncleHashes()", ommersHash=header.ommersHash, error=($$error)
return ok(default(seq[Hash32]))
return ok(rlp.decode(encodedUncles, seq[Header]).mapIt(it.rlpHash))
Expand All @@ -487,15 +487,16 @@ proc getTransactionKey*(
let
txKey = transactionHashToBlockKey(transactionHash)
tx = db.ctx.getKvt().get(txKey.toOpenArray).valueOr:
if error.error == KvtNotFound:
if error.error != KvtNotFound:
warn "getTransactionKey()", transactionHash, error=($$error)
return ok(default(TransactionKey))
return ok(rlp.decode(tx, TransactionKey))

proc headerExists*(db: CoreDbRef; blockHash: Hash32): bool =
## Returns True if the header with the given block hash is in our DB.
db.ctx.getKvt().hasKeyRc(genericHashKey(blockHash).toOpenArray).valueOr:
warn "headerExists()", blockHash, error=($$error)
if error.error != KvtNotFound:
warn "headerExists()", blockHash, error=($$error)
return false
# => true/false

Expand Down

0 comments on commit 1d70ba5

Please sign in to comment.