ValidateBlock validates the given block against the given state. If the block is invalid, it returns an error. Validation does not mutate state, but does require historical information from the stateDB, ie. to verify evidence from a validator at an old height.
(state State, block *types.Block)
| 115 | // Validation does not mutate state, but does require historical information from the stateDB, |
| 116 | // ie. to verify evidence from a validator at an old height. |
| 117 | func (blockExec *BlockExecutor) ValidateBlock(state State, block *types.Block) error { |
| 118 | err := validateBlock(state, block) |
| 119 | if err != nil { |
| 120 | return err |
| 121 | } |
| 122 | return blockExec.evpool.CheckEvidence(block.Evidence.Evidence) |
| 123 | } |
| 124 | |
| 125 | // ApplyBlock validates the block against the state, executes it against the app, |
| 126 | // fires the relevant events, commits the app, and saves the new state and responses. |