internal/ethapi: always return block withdrawals if present (#26565)

The execution-apis specification says that the full list of withdrawals should always be returned when requesting a block over RPC:

378c4304f7/src/schemas/block.yaml (L90-L94)

This change adopts the expected behavior.
This commit is contained in:
lightclient 2023-01-31 01:34:03 -07:00 committed by GitHub
parent efbd508d21
commit bd6a05e1ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -1246,8 +1246,6 @@ func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, config *param
}
}
fields["transactions"] = transactions
// inclTx also expands withdrawals
fields["withdrawals"] = block.Withdrawals()
}
uncles := block.Uncles()
uncleHashes := make([]common.Hash, len(uncles))
@ -1255,7 +1253,9 @@ func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, config *param
uncleHashes[i] = uncle.Hash()
}
fields["uncles"] = uncleHashes
if block.Header().WithdrawalsHash != nil {
fields["withdrawals"] = block.Withdrawals()
}
return fields, nil
}