From 1d70ba5ff0b7f565aee898f137e7603178990f2e Mon Sep 17 00:00:00 2001 From: Jordan Hrycaj Date: Wed, 4 Dec 2024 14:36:15 +0000 Subject: [PATCH] Fix log warnings (`==` should have been `!=`) (#2907) --- nimbus/db/core_db/core_apps.nim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nimbus/db/core_db/core_apps.nim b/nimbus/db/core_db/core_apps.nim index 7eccf7af3..9c35df425 100644 --- a/nimbus/db/core_db/core_apps.nim +++ b/nimbus/db/core_db/core_apps.nim @@ -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) @@ -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])) @@ -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)) @@ -487,7 +487,7 @@ 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)) @@ -495,7 +495,8 @@ proc getTransactionKey*( 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