github.com/kisexp/xdchain@v0.0.0-20211206025815-490d6b732aa7/consensus/istanbul/engine.go (about)

     1  package istanbul
     2  
     3  import (
     4  	"math/big"
     5  	"time"
     6  
     7  	"github.com/kisexp/xdchain/common"
     8  	"github.com/kisexp/xdchain/consensus"
     9  	"github.com/kisexp/xdchain/core/state"
    10  	"github.com/kisexp/xdchain/core/types"
    11  )
    12  
    13  type Engine interface {
    14  	Address() common.Address
    15  	Author(header *types.Header) (common.Address, error)
    16  	Validators(header *types.Header) ([]common.Address, error)
    17  	Signers(header *types.Header) ([]common.Address, error)
    18  	CommitHeader(header *types.Header, seals [][]byte, round *big.Int) error
    19  	VerifyBlockProposal(chain consensus.ChainHeaderReader, block *types.Block, validators ValidatorSet) (time.Duration, error)
    20  	VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, parents []*types.Header, validators ValidatorSet) error
    21  	VerifyUncles(chain consensus.ChainReader, block *types.Block) error
    22  	VerifySeal(chain consensus.ChainHeaderReader, header *types.Header, validators ValidatorSet) error
    23  	Prepare(chain consensus.ChainHeaderReader, header *types.Header, validators ValidatorSet) error
    24  	Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header)
    25  	FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error)
    26  	Seal(chain consensus.ChainHeaderReader, block *types.Block, validators ValidatorSet) (*types.Block, error)
    27  	SealHash(header *types.Header) common.Hash
    28  	CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int
    29  	WriteVote(header *types.Header, candidate common.Address, authorize bool) error
    30  	ReadVote(header *types.Header) (candidate common.Address, authorize bool, err error)
    31  }