return [] instead of null for withdrawals (#7279)

This commit is contained in:
Giulio rebuffo 2023-04-07 23:09:11 +02:00 committed by GitHub
parent 9690228ede
commit c60a6a2962
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -341,6 +341,11 @@ func RPCMarshalBlockExDeprecated(block *types.Block, inclTx bool, fullTx bool, b
fields["withdrawals"] = block.Withdrawals()
}
// Ensure that withdrawals is not null at all times.
if fields["withdrawals"] == nil {
fields["withdrawals"] = []*types.Withdrawal{}
}
return fields, nil
}