Fix Withdrawals Marshalling (#13066)

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Nishant Das
2023-10-19 01:34:12 +08:00
committed by GitHub
parent 6e0715e92a
commit bcc23d2ded

View File

@@ -332,8 +332,9 @@ func (e *ExecutionPayloadCapella) MarshalJSON() ([]byte, error) {
timeStamp := hexutil.Uint64(e.Timestamp)
recipient := common.BytesToAddress(e.FeeRecipient)
logsBloom := hexutil.Bytes(e.LogsBloom)
if e.Withdrawals == nil {
e.Withdrawals = make([]*Withdrawal, 0)
withdrawals := e.Withdrawals
if withdrawals == nil {
withdrawals = make([]*Withdrawal, 0)
}
return json.Marshal(ExecutionPayloadCapellaJSON{
ParentHash: &pHash,
@@ -350,7 +351,7 @@ func (e *ExecutionPayloadCapella) MarshalJSON() ([]byte, error) {
BaseFeePerGas: baseFeeHex,
BlockHash: &bHash,
Transactions: transactions,
Withdrawals: e.Withdrawals,
Withdrawals: withdrawals,
})
}
@@ -763,8 +764,9 @@ func (e *ExecutionPayloadDeneb) MarshalJSON() ([]byte, error) {
timeStamp := hexutil.Uint64(e.Timestamp)
recipient := common.BytesToAddress(e.FeeRecipient)
logsBloom := hexutil.Bytes(e.LogsBloom)
if e.Withdrawals == nil {
e.Withdrawals = make([]*Withdrawal, 0)
withdrawals := e.Withdrawals
if withdrawals == nil {
withdrawals = make([]*Withdrawal, 0)
}
blobGasUsed := hexutil.Uint64(e.BlobGasUsed)
excessBlobGas := hexutil.Uint64(e.ExcessBlobGas)
@@ -784,7 +786,7 @@ func (e *ExecutionPayloadDeneb) MarshalJSON() ([]byte, error) {
BaseFeePerGas: baseFeeHex,
BlockHash: &bHash,
Transactions: transactions,
Withdrawals: e.Withdrawals,
Withdrawals: withdrawals,
BlobGasUsed: &blobGasUsed,
ExcessBlobGas: &excessBlobGas,
})