Update Transactions and ExtraData non empty check (#10049)

This commit is contained in:
terence tsao 2022-01-03 14:53:39 -08:00 committed by GitHub
parent ebedf481f8
commit ceabee0198
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -25,7 +25,7 @@ func MergeComplete(st state.BeaconState) (bool, error) {
}
// IsMergeBlock returns true if the input block is the terminal merge block.
// Meaning the header header in beacon state is `ExecutionPayloadHeader()` (i.e. empty).
// Meaning the header in beacon state is `ExecutionPayloadHeader()` (i.e. empty).
// And the input block has a non-empty header.
//
// Spec code:
@ -89,10 +89,10 @@ func isEmptyPayload(p *ethpb.ExecutionPayload) bool {
if !bytes.Equal(p.BlockHash, make([]byte, fieldparams.RootLength)) {
return false
}
if p.Transactions != nil {
if len(p.Transactions) != 0 {
return false
}
if p.ExtraData != nil {
if len(p.ExtraData) != 0 {
return false
}
if p.BlockNumber != 0 {
@ -138,7 +138,7 @@ func isEmptyHeader(h *ethpb.ExecutionPayloadHeader) bool {
if !bytes.Equal(h.TransactionsRoot, make([]byte, fieldparams.RootLength)) {
return false
}
if h.ExtraData != nil {
if len(h.ExtraData) != 0 {
return false
}
if h.BlockNumber != 0 {

View File

@ -431,6 +431,7 @@ func emptyPayloadHeader() *ethpb.ExecutionPayloadHeader {
BaseFeePerGas: make([]byte, fieldparams.RootLength),
BlockHash: make([]byte, fieldparams.RootLength),
TransactionsRoot: make([]byte, fieldparams.RootLength),
ExtraData: make([]byte, 0),
}
}
@ -444,5 +445,7 @@ func emptyPayload() *ethpb.ExecutionPayload {
Random: make([]byte, fieldparams.RootLength),
BaseFeePerGas: make([]byte, fieldparams.RootLength),
BlockHash: make([]byte, fieldparams.RootLength),
Transactions: make([][]byte, 0),
ExtraData: make([]byte, 0),
}
}