'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.}
|
||||
|
|
|
@ -18,15 +18,15 @@ suite "Account State DB":
|
|||
|
||||
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
|
||||
|
@ -42,4 +42,4 @@ suite "Account State DB":
|
|||
code = @[]
|
||||
stateDB.setCode(address, code.toRange)
|
||||
check stateDB.isDeadAccount(address) == true
|
||||
check stateDB.accountExist(address) == true
|
||||
check stateDB.accountExists(address) == true
|
||||
|
|
Loading…
Reference in New Issue