'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
|
let address = addressS.parseAddress
|
||||||
return fmt"{addressS}: Storage: {db.getStorage(address, 0.u256)}; getAccount: {db.getAccount address}"
|
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
|
db.trie.get(createRangeFromAddress address).len > 0
|
||||||
|
|
||||||
proc isDeadAccount*(db: AccountStateDB, address: EthAddress): bool =
|
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 getNonce*(db: ReadOnlyStateDB, address: EthAddress): AccountNonce {.borrow.}
|
||||||
proc getCode*(db: ReadOnlyStateDB, address: EthAddress): ByteRange {.borrow.}
|
proc getCode*(db: ReadOnlyStateDB, address: EthAddress): ByteRange {.borrow.}
|
||||||
proc hasCodeOrNonce*(db: ReadOnlyStateDB, address: EthAddress): bool {.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.}
|
proc isDeadAccount*(db: ReadOnlyStateDB, address: EthAddress): bool {.borrow.}
|
||||||
|
|
|
@ -18,15 +18,15 @@ suite "Account State DB":
|
||||||
|
|
||||||
hexToByteArray("0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", address)
|
hexToByteArray("0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", address)
|
||||||
|
|
||||||
test "accountExist and isDeadAccount":
|
test "accountExists and isDeadAccount":
|
||||||
check stateDB.accountExist(address) == false
|
check stateDB.accountExists(address) == false
|
||||||
check stateDB.isDeadAccount(address) == true
|
check stateDB.isDeadAccount(address) == true
|
||||||
|
|
||||||
var acc = stateDB.getAccount(address)
|
var acc = stateDB.getAccount(address)
|
||||||
acc.balance = 1000.u256
|
acc.balance = 1000.u256
|
||||||
stateDB.setAccount(address, acc)
|
stateDB.setAccount(address, acc)
|
||||||
|
|
||||||
check stateDB.accountExist(address) == true
|
check stateDB.accountExists(address) == true
|
||||||
check stateDB.isDeadAccount(address) == false
|
check stateDB.isDeadAccount(address) == false
|
||||||
|
|
||||||
acc.balance = 0.u256
|
acc.balance = 0.u256
|
||||||
|
@ -42,4 +42,4 @@ suite "Account State DB":
|
||||||
code = @[]
|
code = @[]
|
||||||
stateDB.setCode(address, code.toRange)
|
stateDB.setCode(address, code.toRange)
|
||||||
check stateDB.isDeadAccount(address) == true
|
check stateDB.isDeadAccount(address) == true
|
||||||
check stateDB.accountExist(address) == true
|
check stateDB.accountExists(address) == true
|
||||||
|
|
Loading…
Reference in New Issue