Documentation ¶
Index ¶
- func BuildBlock(params BuildBlockParams) *types.Block
- type BuildBlockParams
- type Config
- type Consensus
- type ConsensusParams
- type Factory
- type Metrics
- type NoProof
- func (n *NoProof) Close() error
- func (n *NoProof) Finalize(txn *state.Txn, block *types.Block) error
- func (n *NoProof) Prepare(header *types.Header) error
- func (n *NoProof) Seal(block *types.Block, ctx context.Context) (*types.Block, error)
- func (n *NoProof) VerifyHeader(header *types.Header, uncle, seal bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildBlock ¶
func BuildBlock(params BuildBlockParams) *types.Block
BuildBlock is a utility function that builds a block, based on the passed in header, transactions and receipts
Types ¶
type BuildBlockParams ¶
type BuildBlockParams struct { Header *types.Header Txns []*types.Transaction Receipts []*types.Receipt }
BuildBlockParams are parameters passed into the BuildBlock helper method
type Config ¶
type Config struct { // Logger to be used by the backend Logger *log.Logger // Params are the params of the chain and the consensus Params *chain.Params // Config defines specific configuration parameters for the backend Config map[string]interface{} // Path is the directory path for the consensus protocol tos tore information Path string }
Config is the configuration for the consensus
type Consensus ¶
type Consensus interface { // VerifyHeader verifies the header is correct VerifyHeader(header *types.Header) error // ProcessHeaders updates the snapshot based on the verified headers ProcessHeaders(headers []*types.Header) error // GetBlockCreator retrieves the block creator (or signer) given the block header GetBlockCreator(header *types.Header) (types.Address, error) // PreStateCommit a hook to be called before finalizing state transition on inserting block PreStateCommit(header *types.Header, txn *state.Transition) error // GetSyncProgression retrieves the current sync progression, if any GetSyncProgression() *progress.Progression // Initialize initializes the consensus (e.g. setup data) Initialize() error // Start starts the consensus and servers Start() error // Close closes the connection Close() error // Is a transaction systemctem transaction on a specific block height and coinbase IsSystemTransaction(height uint64, coinbase types.Address, tx *types.Transaction) bool }
Consensus is the public interface for consensus mechanism Each consensus mechanism must implement this interface in order to be valid
type ConsensusParams ¶
type ConsensusParams struct { Context context.Context Seal bool Config *Config Txpool *txpool.TxPool Network network.Server Blockchain *blockchain.Blockchain Executor *state.Executor Grpc *grpc.Server Logger hclog.Logger Metrics *Metrics SecretsManager secrets.SecretsManager BlockTime uint64 BlockBroadcast bool }
type Factory ¶
type Factory func( *ConsensusParams, ) (Consensus, error)
Factory is the factory function to create a discovery backend
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics represents the consensus metrics
func GetPrometheusMetrics ¶
GetPrometheusMetrics return the consensus metrics instance
func (*Metrics) SetBlockInterval ¶ added in v1.2.2
func (*Metrics) SetValidators ¶ added in v1.2.2
type NoProof ¶
type NoProof struct { }
NoProof is a consensus algorithm that validates everything
func (*NoProof) Prepare ¶
Prepare initializes the consensus fields of a block header according to the rules of a particular engine. The changes are executed inline.