nimbus-eth1/nimbus/db/values_from_bytes.nim
Adam Spitz c58d83efd5
More work on stateless mode (#1535)
* Reviving more of the code for stateless mode.

* Made asyncProcessTransaction.

* More work on stateless mode.
2023-04-12 08:39:11 -04:00

19 lines
415 B
Nim

# This code was duplicated enough times around the codebase
# that it seemed worth factoring it out.
import
stint,
eth/[common, rlp]
proc accountFromBytes*(accountBytes: seq[byte]): Account =
if accountBytes.len > 0:
rlp.decode(accountBytes, Account)
else:
newAccount()
proc slotValueFromBytes*(rec: seq[byte]): UInt256 =
if rec.len > 0:
rlp.decode(rec, UInt256)
else:
UInt256.zero()