Skip to content

Commit

Permalink
client/block: ensure BlockBodies requests get properly propagated (#3673
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jochem-brouwer authored Sep 17, 2024
1 parent 47f388b commit 766bd8f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/block/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export type BlockBodyBytes = [
TransactionsBytes,
UncleHeadersBytes,
WithdrawalsBytes?,
RequestBytes?,
RequestsBytes?,
]
/**
* TransactionsBytes can be an array of serialized txs for Typed Transactions or an array of Uint8Array Arrays for legacy transactions.
Expand Down
5 changes: 4 additions & 1 deletion packages/client/src/sync/fetcher/blockfetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class BlockFetcher extends BlockFetcherBase<Block[], Block> {
`Requested blocks=${blocksRange} from ${peerInfo} (received: ${headers.length} headers / ${bodies.length} bodies)`,
)
const blocks: Block[] = []
for (const [i, [txsData, unclesData, withdrawalsData]] of bodies.entries()) {
for (const [i, [txsData, unclesData, withdrawalsData, requestsData]] of bodies.entries()) {
const header = headers[i]
if (
(!equalsBytes(header.transactionsTrie, KECCAK256_RLP) && txsData.length === 0) ||
Expand All @@ -92,6 +92,9 @@ export class BlockFetcher extends BlockFetcherBase<Block[], Block> {
if (withdrawalsData !== undefined) {
values.push(withdrawalsData)
}
if (requestsData !== undefined) {
values.push(requestsData)
}
// Supply the common from the corresponding block header already set on correct fork
const block = createBlockFromBytesArray(values, { common: headers[i].common })
// Only validate the data integrity
Expand Down

0 comments on commit 766bd8f

Please sign in to comment.