Skip to content

Commit

Permalink
core: allow external code to set the block validator for malicious te…
Browse files Browse the repository at this point in the history
…sts (ethereum#25119)

* core: don't validate state

* core: allow external validator

* core: revert

* core: comments

* Update blockchain_reader.go

* core: move SetValidator to blockchain.go

* core: rename method
  • Loading branch information
MariusVanDerWijden authored and blakehhuynh committed Oct 3, 2022
1 parent 3a6227f commit 433169d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/blockchain.go
Expand Up @@ -2374,3 +2374,10 @@ func (bc *BlockChain) InsertHeaderChain(chain []*types.Header, checkFreq int) (i
_, err := bc.hc.InsertHeaderChain(chain, start, bc.forker)
return 0, err
}

// SetBlockValidatorForTesting sets the current validator.
// This method can be used to force an invalid blockchain to be verified for tests.
// This method is unsafe and should only be used before block import starts.
func (bc *BlockChain) SetBlockValidatorForTesting(v Validator) {
bc.validator = v
}

0 comments on commit 433169d

Please sign in to comment.