diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-04-05 06:16:29 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2017-04-05 06:16:29 +0800 |
commit | 09777952ee476ff80d4b6e63b5041ff5ca0e441b (patch) | |
tree | e85320f88f548201e3476b3e7095e96fd071617b /core/types.go | |
parent | e50a5b77712d891ff409aa942a5cbc24e721b332 (diff) | |
download | go-tangerine-09777952ee476ff80d4b6e63b5041ff5ca0e441b.tar.gz go-tangerine-09777952ee476ff80d4b6e63b5041ff5ca0e441b.tar.zst go-tangerine-09777952ee476ff80d4b6e63b5041ff5ca0e441b.zip |
core, consensus: pluggable consensus engines (#3817)
This commit adds pluggable consensus engines to go-ethereum. In short, it
introduces a generic consensus interface, and refactors the entire codebase to
use this interface.
Diffstat (limited to 'core/types.go')
-rw-r--r-- | core/types.go | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/core/types.go b/core/types.go index 7fd658979..1cfbbab29 100644 --- a/core/types.go +++ b/core/types.go @@ -24,31 +24,17 @@ import ( "github.com/ethereum/go-ethereum/core/vm" ) -// Validator is an interface which defines the standard for block validation. +// Validator is an interface which defines the standard for block validation. It +// is only responsible for validating block contents, as the header validation is +// done by the specific consensus engines. // -// The validator is responsible for validating incoming block or, if desired, -// validates headers for fast validation. -// -// ValidateBlock validates the given block and should return an error if it -// failed to do so and should be used for "full" validation. -// -// ValidateHeader validates the given header and parent and returns an error -// if it failed to do so. -// -// ValidateState validates the given statedb and optionally the receipts and -// gas used. The implementer should decide what to do with the given input. type Validator interface { - HeaderValidator - ValidateBlock(block *types.Block) error - ValidateState(block, parent *types.Block, state *state.StateDB, receipts types.Receipts, usedGas *big.Int) error -} + // ValidateBody validates the given block's content. + ValidateBody(block *types.Block) error -// HeaderValidator is an interface for validating headers only -// -// ValidateHeader validates the given header and parent and returns an error -// if it failed to do so. -type HeaderValidator interface { - ValidateHeader(header, parent *types.Header, checkPow bool) error + // ValidateState validates the given statedb and optionally the receipts and + // gas used. + ValidateState(block, parent *types.Block, state *state.StateDB, receipts types.Receipts, usedGas *big.Int) error } // Processor is an interface for processing blocks using a given initial state. |