Skip to content

Commit

Permalink
fix qa
Browse files Browse the repository at this point in the history
  • Loading branch information
blxdyx committed Dec 23, 2024
1 parent abf2bae commit 3a4267a
Showing 1 changed file with 26 additions and 41 deletions.
67 changes: 26 additions & 41 deletions core/types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down

0 comments on commit 3a4267a

Please sign in to comment.