Skip to content

Commit

Permalink
fix failed check for WithdrawalsHash (#2276)
Browse files Browse the repository at this point in the history
  • Loading branch information
buddh0 authored Mar 12, 2024
1 parent 93f1e96 commit 74019be
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions consensus/parlia/parlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,14 +583,6 @@ func (p *Parlia) verifyHeader(chain consensus.ChainHeaderReader, header *types.H
return err
}

// Verify existence / non-existence of withdrawalsHash.
if header.WithdrawalsHash != nil {
return fmt.Errorf("invalid withdrawalsHash: have %x, expected nil", header.WithdrawalsHash)
}
// Verify the existence / non-existence of cancun-specific header fields
if header.ParentBeaconRoot != nil {
return fmt.Errorf("invalid parentBeaconRoot, have %#x, expected nil", header.ParentBeaconRoot)
}
cancun := chain.Config().IsCancun(header.Number, header.Time)
if !cancun {
switch {
Expand All @@ -607,7 +599,9 @@ func (p *Parlia) verifyHeader(chain consensus.ChainHeaderReader, header *types.H
switch {
case header.ParentBeaconRoot != nil:
return fmt.Errorf("invalid parentBeaconRoot, have %#x, expected nil", header.ParentBeaconRoot)
case *header.WithdrawalsHash != common.Hash{}:
// types.EmptyWithdrawalsHash represents a empty value when EIP-4895 enabled,
// here, EIP-4895 still be disabled, value expected to be `common.Hash{}` is only to feet the demand of rlp encode/decode
case header.WithdrawalsHash == nil || *header.WithdrawalsHash != common.Hash{}:
return errors.New("header has wrong WithdrawalsHash")
}
if err := eip4844.VerifyEIP4844Header(parent, header); err != nil {
Expand Down

0 comments on commit 74019be

Please sign in to comment.