Fix log warnings (`==` should have been `!=`) (#2907)

This commit is contained in:
Jordan Hrycaj 2024-12-04 14:36:15 +00:00 committed by GitHub
parent 1101895f92
commit 1d70ba5ff0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 5 deletions

View File

@ -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,6 +495,7 @@ 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:
if error.error != KvtNotFound:
warn "headerExists()", blockHash, error=($$error)
return false
# => true/false