Fixed transaction to serialization
This commit is contained in:
parent
3e721c28b3
commit
d1ed8ecc28
|
@ -27,12 +27,14 @@ type
|
||||||
accountNonce*: AccountNonce
|
accountNonce*: AccountNonce
|
||||||
gasPrice*: GasInt
|
gasPrice*: GasInt
|
||||||
gasLimit*: GasInt
|
gasLimit*: GasInt
|
||||||
to*: EthAddress
|
to* {.rlpCustomSerialization: TxAddressTag.}: EthAddress
|
||||||
value*: UInt256
|
value*: UInt256
|
||||||
payload*: Blob
|
payload*: Blob
|
||||||
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
|
||||||
|
@ -173,6 +175,20 @@ 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.} =
|
||||||
|
# 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)
|
||||||
|
if a == d:
|
||||||
|
rlpWriter.append("")
|
||||||
|
else:
|
||||||
|
rlpWriter.append(a)
|
||||||
|
|
||||||
proc read*(rlp: var Rlp, T: typedesc[MDigest]): T {.inline.} =
|
proc read*(rlp: var Rlp, T: typedesc[MDigest]): T {.inline.} =
|
||||||
result.data = rlp.read(type(result.data))
|
result.data = rlp.read(type(result.data))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue