Skip to content

Commit

Permalink
modify validator
Browse files Browse the repository at this point in the history
  • Loading branch information
erickyan86 committed Dec 2, 2019
1 parent 8d82e26 commit e220bfd
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions processor/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,16 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {
return err
}

// Header validity is known at this point, check the uncles and transactions
if hash := types.DeriveTxsMerkleRoot(block.Txs); hash != block.TxHash() {
return fmt.Errorf("transaction root hash mismatch: have %x, want %x", hash, block.TxHash())
if block.CurForkID() >= params.ForkID4 {
// Header validity is known at this point, check the uncles and transactions
if hash := types.DeriveExtensTxsMerkleRoot(block.Txs); hash != block.TxHash() {
return fmt.Errorf("transaction root hash mismatch: have %x, want %x", hash, block.TxHash())
}
} else {
// Header validity is known at this point, check the uncles and transactions
if hash := types.DeriveTxsMerkleRoot(block.Txs); hash != block.TxHash() {
return fmt.Errorf("transaction root hash mismatch: have %x, want %x", hash, block.TxHash())
}
}
return nil
}
Expand Down

0 comments on commit e220bfd

Please sign in to comment.