diff --git a/core/types/block.go b/core/types/block.go index cf119116527..a48e4f94440 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -1680,51 +1680,36 @@ func SealHash(header *Header, chainId *big.Int) (hash libcommon.Hash) { } func EncodeSigHeader(w io.Writer, header *Header, chainId *big.Int) { - var err error - if header.ParentBeaconBlockRoot != nil && *header.ParentBeaconBlockRoot == (libcommon.Hash{}) { - err = rlp.Encode(w, []interface{}{ - chainId, - header.ParentHash, - header.UncleHash, - header.Coinbase, - header.Root, - header.TxHash, - header.ReceiptHash, - header.Bloom, - header.Difficulty, - header.Number, - header.GasLimit, - header.GasUsed, - header.Time, - header.Extra[:len(header.Extra)-extraSeal], // this will panic if extra is too short, should check before calling encodeSigHeader - header.MixDigest, - header.Nonce, - header.BaseFee, + toEncode := []interface{}{ + chainId, + header.ParentHash, + header.UncleHash, + header.Coinbase, + header.Root, + header.TxHash, + header.ReceiptHash, + header.Bloom, + header.Difficulty, + header.Number, + header.GasLimit, + header.GasUsed, + header.Time, + header.Extra[:len(header.Extra)-extraSeal], // this will panic if extra is too short, should check before calling encodeSigHeader + header.MixDigest, + header.Nonce, + } + if header.ParentBeaconBlockRoot != nil { + toEncode = append(toEncode, header.BaseFee, header.WithdrawalsHash, header.BlobGasUsed, header.ExcessBlobGas, - header.ParentBeaconBlockRoot, - }) - } else { - err = rlp.Encode(w, []interface{}{ - chainId, - header.ParentHash, - header.UncleHash, - header.Coinbase, - header.Root, - header.TxHash, - header.ReceiptHash, - header.Bloom, - header.Difficulty, - header.Number, - header.GasLimit, - header.GasUsed, - header.Time, - header.Extra[:len(header.Extra)-extraSeal], // this will panic if extra is too short, should check before calling encodeSigHeader - header.MixDigest, - header.Nonce, - }) + header.ParentBeaconBlockRoot) + + if header.RequestsHash != nil { + toEncode = append(toEncode, header.RequestsHash) + } } + err := rlp.Encode(w, toEncode) if err != nil { panic("can't encode: " + err.Error()) }