mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-24 03:00:25 +00:00
'accountExist' to 'accountExists'
This commit is contained in:
parent
4cc0ef427c
commit
7c6c7dbe3a
@ -178,7 +178,7 @@ proc dumpAccount*(db: AccountStateDB, addressS: string): string =
|
||||
let address = addressS.parseAddress
|
||||
return fmt"{addressS}: Storage: {db.getStorage(address, 0.u256)}; getAccount: {db.getAccount address}"
|
||||
|
||||
proc accountExist*(db: AccountStateDB, address: EthAddress): bool =
|
||||
proc accountExists*(db: AccountStateDB, address: EthAddress): bool =
|
||||
db.trie.get(createRangeFromAddress address).len > 0
|
||||
|
||||
proc isDeadAccount*(db: AccountStateDB, address: EthAddress): bool =
|
||||
@ -200,5 +200,5 @@ proc getStorage*(db: ReadOnlyStateDB, address: EthAddress, slot: UInt256): (UInt
|
||||
proc getNonce*(db: ReadOnlyStateDB, address: EthAddress): AccountNonce {.borrow.}
|
||||
proc getCode*(db: ReadOnlyStateDB, address: EthAddress): ByteRange {.borrow.}
|
||||
proc hasCodeOrNonce*(db: ReadOnlyStateDB, address: EthAddress): bool {.borrow.}
|
||||
proc accountExist*(db: ReadOnlyStateDB, address: EthAddress): bool {.borrow.}
|
||||
proc accountExists*(db: ReadOnlyStateDB, address: EthAddress): bool {.borrow.}
|
||||
proc isDeadAccount*(db: ReadOnlyStateDB, address: EthAddress): bool {.borrow.}
|
||||
|
@ -15,31 +15,31 @@ suite "Account State DB":
|
||||
trie = initHexaryTrie(memDB)
|
||||
stateDB = newAccountStateDB(memDB, trie.rootHash, true)
|
||||
address: EthAddress
|
||||
|
||||
|
||||
hexToByteArray("0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", address)
|
||||
|
||||
test "accountExist and isDeadAccount":
|
||||
check stateDB.accountExist(address) == false
|
||||
|
||||
test "accountExists and isDeadAccount":
|
||||
check stateDB.accountExists(address) == false
|
||||
check stateDB.isDeadAccount(address) == true
|
||||
|
||||
|
||||
var acc = stateDB.getAccount(address)
|
||||
acc.balance = 1000.u256
|
||||
stateDB.setAccount(address, acc)
|
||||
|
||||
check stateDB.accountExist(address) == true
|
||||
|
||||
check stateDB.accountExists(address) == true
|
||||
check stateDB.isDeadAccount(address) == false
|
||||
|
||||
acc.balance = 0.u256
|
||||
acc.nonce = 1
|
||||
stateDB.setAccount(address, acc)
|
||||
check stateDB.isDeadAccount(address) == false
|
||||
|
||||
|
||||
var code = hexToSeqByte("0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6")
|
||||
stateDB.setCode(address, code.toRange)
|
||||
stateDB.setNonce(address, 0)
|
||||
check stateDB.isDeadAccount(address) == false
|
||||
|
||||
|
||||
code = @[]
|
||||
stateDB.setCode(address, code.toRange)
|
||||
check stateDB.isDeadAccount(address) == true
|
||||
check stateDB.accountExist(address) == true
|
||||
check stateDB.accountExists(address) == true
|
||||
|
Loading…
x
Reference in New Issue
Block a user