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 (#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 Jul 4, 2022
1 parent 62470ee commit e537193
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/blockchain.go
Original file line number Diff line number Diff line change
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 e537193

Please sign in to comment.