From 9e89f0dccc54e4c8a670d073175de720af3423dc Mon Sep 17 00:00:00 2001 From: Adam Spitz Date: Fri, 17 Mar 2023 10:41:38 -0400 Subject: [PATCH] Made rlp.readRecordType(BlockBody, false) include withdrawals. (#594) --- eth/common/eth_types_rlp.nim | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/eth/common/eth_types_rlp.nim b/eth/common/eth_types_rlp.nim index a79366a..d325bcb 100644 --- a/eth/common/eth_types_rlp.nim +++ b/eth/common/eth_types_rlp.nim @@ -368,11 +368,15 @@ proc append*(w: var RlpWriter, b: BlockBody) = # `readRecordType` as well as `read`. --Adam proc readRecordType*(rlp: var Rlp, T: type BlockBody, wrappedInList: bool): BlockBody = if not wrappedInList: - # I think this just means the RLP will contain a list - # of transactions (without any uncles or withdrawals). result.transactions = rlp.read(seq[Transaction]) result.uncles = rlp.read(seq[BlockHeader]) - result.withdrawals = none[seq[Withdrawal]]() + # Is this the right thing to do here? I don't really + # understand what wrappedInList is used for. --Adam + result.withdrawals = + if rlp.hasData: + some(rlp.read(seq[Withdrawal])) + else: + none[seq[Withdrawal]]() else: let len = rlp.listLen