diff --git a/eth_common/eth_types.nim b/eth_common/eth_types.nim index df1c190..bc2f9bb 100644 --- a/eth_common/eth_types.nim +++ b/eth_common/eth_types.nim @@ -23,6 +23,8 @@ type ## Type alias used for gas computation # For reference - https://github.com/status-im/nimbus/issues/35#issuecomment-391726518 + TxAddressTag* = object # In transactions zero address is encoded as empty blob + Transaction* = object accountNonce*: AccountNonce gasPrice*: GasInt @@ -33,8 +35,6 @@ type V*: byte R*, S*: UInt256 - TxAddressTag* = object # In transactions zero address is encoded as empty blob - BlockNumber* = UInt256 BlockHeader* = object @@ -175,12 +175,11 @@ proc append*(rlpWriter: var RlpWriter, value: Stint) = {.error: "RLP serialization of signed integers is not allowed".} discard -# BUG! The compilation is successfull with the following prox commented out, because this proc is ignored even if present -# proc read*(rlp: var Rlp, T: typedesc[EthAddress], tag: type TxAddressTag): T {.inline.} = -# if rlp.blobLen != 0: -# result = rlp.read(EthAddress) -# else: -# rlp.skipElem +proc read*(rlp: var Rlp, T: typedesc[EthAddress], tag: type TxAddressTag): T {.inline.} = + if rlp.blobLen != 0: + result = rlp.read(EthAddress) + else: + rlp.skipElem proc append*(rlpWriter: var RlpWriter, a: EthAddress, tag: type TxAddressTag) {.inline.} = var d: type(a)