mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
better comment. log when a block cross-validates successfully
This commit is contained in:
parent
ad291040a3
commit
063776f8ee
2 changed files with 6 additions and 4 deletions
|
|
@ -1382,6 +1382,8 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.
|
|||
// TODO: return the error and stop importing the current chain.
|
||||
// I'm leaving it like this so I can watch validation errors as
|
||||
// the client follows the chain.
|
||||
} else {
|
||||
log.Info("successfully cross-validated block", "number", witness.Block.NumberU64(), "hash", witness.Block.Hash())
|
||||
}
|
||||
}
|
||||
// Irrelevant of the canonical status, write the block itself to the database.
|
||||
|
|
|
|||
|
|
@ -26,9 +26,10 @@ type crossValidator struct {
|
|||
// TODO: differentiate between errors from witness verification (maybe consensus
|
||||
// failure) and anything else.
|
||||
func (c *crossValidator) CrossValidateBlock(chainConfig *params.ChainConfig, witness *state.Witness) error {
|
||||
// encode the witness to RLP, zeroing-out the block state root before sending
|
||||
// it for cross validation to make it impossible for a cross-validator to
|
||||
// produce a correct validation result without computing it.
|
||||
// encode the witness to RLP, zeroing-out the block state root before encoding.
|
||||
// this is to make it impossible for a cross-validator to
|
||||
// produce a correct post-state root without executing the
|
||||
// witness themselves.
|
||||
enc, _ := witness.EncodeRLP()
|
||||
|
||||
// TODO: implement retry if endpoint can't be reached
|
||||
|
|
@ -55,7 +56,6 @@ func (c *crossValidator) CrossValidateBlock(chainConfig *params.ChainConfig, wit
|
|||
if bytes.Compare(body, witness.Block.Header().Root[:]) != 0 {
|
||||
if errInner := state.DumpBlockWitnessToFile(chainConfig, witness, c.witnessRecordingPath); errInner != nil {
|
||||
log.Error("failed to dump block to file", "error", errInner)
|
||||
panic("should not happen")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue