4 "github.com/vapor/chain"
5 "github.com/vapor/protocol/bc"
6 "github.com/vapor/protocol/bc/types"
9 // Engine is an algorithm agnostic consensus engine.
10 type Engine interface {
12 // VerifySeal checks whether the crypto seal on a header is valid according to
13 // the consensus rules of the given engine.
14 VerifySeal(c chain.Chain, header *types.BlockHeader) error
16 // Prepare initializes the consensus fields of a block header according to the
17 // rules of a particular engine. The changes are executed inline.
18 Prepare(c chain.Chain, header *types.BlockHeader) error
20 // Finalize runs any post-transaction state modifications (e.g. block rewards)
21 // and assembles the final block.
22 // Note: The block header and state database might be updated to reflect any
23 // consensus rules that happen at finalization (e.g. block rewards).
24 Finalize(c chain.Chain, header *types.BlockHeader, txs []*bc.Tx) error
26 // Seal generates a new block for the given input block with the local miner's
28 Seal(c chain.Chain, block *types.Block) (*types.Block, error)