Skip to content

Commit

Permalink
LedgerRef: stateOrVoid become stateEmptyOrVoid (status-im#2394)
Browse files Browse the repository at this point in the history
  • Loading branch information
jangko committed Jun 19, 2024
1 parent c8ae6b1 commit 0e5fd3f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions nimbus/db/core_db/base.nim
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,9 @@ proc state*(col: CoreDbColRef): CoreDbRc[Hash256] =
# Note: tracker will be silent if `vid` is NIL
col.ifTrackNewApi: debug newApiTxt, api, elapsed, col, result

proc stateOrVoid*(col: CoreDbColRef): Hash256 =
## Convenience wrapper, returns `EMPTY_ROOT_HASH` where `state()` would fail.
col.state.valueOr: EMPTY_ROOT_HASH
proc stateEmptyOrVoid*(col: CoreDbColRef): bool =
## Convenience wrapper, returns `true` where `stateEmpty()` would fail.
col.stateEmpty.valueOr: true

# ------------------------------------------------------------------------------
# Public Merkle Patricia Tree, hexary trie constructors
Expand Down
2 changes: 1 addition & 1 deletion nimbus/db/ledger/accounts_ledger.nim
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ proc contractCollision*(ac: AccountsLedgerRef, address: EthAddress): bool =
return
acc.statement.nonce != 0 or
acc.statement.codeHash != EMPTY_CODE_HASH or
acc.statement.storage.stateOrVoid != EMPTY_ROOT_HASH
not acc.statement.storage.stateEmptyOrVoid

proc accountExists*(ac: AccountsLedgerRef, address: EthAddress): bool =
let acc = ac.getAccount(address, false)
Expand Down

0 comments on commit 0e5fd3f

Please sign in to comment.