Fix the Transaction object serialization issues

This requires the use of the latest compiler from the nimbus branch.
This commit is contained in:
Zahary Karadjov 2018-09-17 18:28:15 +03:00
parent d1ed8ecc28
commit 4f69b8e2ff
1 changed files with 7 additions and 8 deletions

View File

@ -23,6 +23,8 @@ type
## Type alias used for gas computation ## Type alias used for gas computation
# For reference - https://github.com/status-im/nimbus/issues/35#issuecomment-391726518 # 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 Transaction* = object
accountNonce*: AccountNonce accountNonce*: AccountNonce
gasPrice*: GasInt gasPrice*: GasInt
@ -33,8 +35,6 @@ type
V*: byte V*: byte
R*, S*: UInt256 R*, S*: UInt256
TxAddressTag* = object # In transactions zero address is encoded as empty blob
BlockNumber* = UInt256 BlockNumber* = UInt256
BlockHeader* = object BlockHeader* = object
@ -175,12 +175,11 @@ proc append*(rlpWriter: var RlpWriter, value: Stint) =
{.error: "RLP serialization of signed integers is not allowed".} {.error: "RLP serialization of signed integers is not allowed".}
discard 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.} =
# proc read*(rlp: var Rlp, T: typedesc[EthAddress], tag: type TxAddressTag): T {.inline.} = if rlp.blobLen != 0:
# if rlp.blobLen != 0: result = rlp.read(EthAddress)
# result = rlp.read(EthAddress) else:
# else: rlp.skipElem
# rlp.skipElem
proc append*(rlpWriter: var RlpWriter, a: EthAddress, tag: type TxAddressTag) {.inline.} = proc append*(rlpWriter: var RlpWriter, a: EthAddress, tag: type TxAddressTag) {.inline.} =
var d: type(a) var d: type(a)