Made rlp.readRecordType(BlockBody, false) include withdrawals. (#594)

This commit is contained in:
Adam Spitz 2023-03-17 10:41:38 -04:00 committed by GitHub
parent d2ba753792
commit 9e89f0dccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -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