Documentation ¶
Index ¶
- type Dexcon
- func (d *Dexcon) APIs(chain consensus.ChainReader) []rpc.API
- func (d *Dexcon) Author(header *types.Header) (common.Address, error)
- func (d *Dexcon) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
- func (d *Dexcon) Close() error
- func (d *Dexcon) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (d *Dexcon) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (d *Dexcon) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, ...) error
- func (d *Dexcon) SealHash(header *types.Header) (hash common.Hash)
- func (d *Dexcon) SetGovStateFetcher(fetcher GovernanceStateFetcher)
- func (d *Dexcon) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (d *Dexcon) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (d *Dexcon) VerifySeal(chain consensus.ChainReader, header *types.Header) error
- func (d *Dexcon) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
- type FakeDexcon
- type GovernanceStateFetcher
- type Node
- func (n *Node) Address() common.Address
- func (n *Node) CreateGovTx(nonce uint64, data []byte) *types.Transaction
- func (n *Node) DKGFinalize(round uint64) *coreTypesDKG.Finalize
- func (n *Node) DKGID() coreDKG.ID
- func (n *Node) DKGMPKReady(round uint64) *coreTypesDKG.MPKReady
- func (n *Node) ID() coreTypes.NodeID
- func (n *Node) MasterPublicKey(round uint64) *coreTypesDKG.MasterPublicKey
- type NodeSet
- func (n *NodeSet) CRS(round uint64) common.Hash
- func (n *NodeSet) Nodes(round uint64) []*Node
- func (n *NodeSet) Randomness(round uint64, hash common.Hash) []byte
- func (n *NodeSet) RunDKG(round uint64, threshold int)
- func (n *NodeSet) SignCRS(round uint64)
- func (n *NodeSet) SignedCRS(round uint64) []byte
- func (n *NodeSet) TSig(round uint64, hash common.Hash) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dexcon ¶
type Dexcon struct {
// contains filtered or unexported fields
}
Dexcon is a delegated proof-of-stake consensus engine.
func New ¶
func New() *Dexcon
New creates a Clique proof-of-authority consensus engine with the initial signers set to the ones provided by the user.
func (*Dexcon) APIs ¶
func (d *Dexcon) APIs(chain consensus.ChainReader) []rpc.API
APIs implements consensus.Engine, returning the user facing RPC API to allow controlling the signer voting.
func (*Dexcon) Author ¶
Author implements consensus.Engine, returning the Ethereum address recovered from the signature in the header's extra-data section.
func (*Dexcon) CalcDifficulty ¶
func (d *Dexcon) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
CalcDifficulty is the difficulty adjustment algorithm. It returns the difficulty that a new block should have based on the previous blocks in the chain and the current signer.
func (*Dexcon) Close ¶
Close implements consensus.Engine. It's a noop for clique as there is are no background threads.
func (*Dexcon) Finalize ¶
func (d *Dexcon) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error)
Finalize implements consensus.Engine, ensuring no uncles are set, nor block rewards given, and returns the final block.
func (*Dexcon) Prepare ¶
Prepare implements consensus.Engine, preparing all the consensus fields of the header for running the transactions on top.
func (*Dexcon) Seal ¶
func (d *Dexcon) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error
Seal implements consensus.Engine, attempting to create a sealed block using the local signing credentials.
func (*Dexcon) SetGovStateFetcher ¶
func (d *Dexcon) SetGovStateFetcher(fetcher GovernanceStateFetcher)
SetGovStateFetcher sets the config fetcher for Dexcon. The reason this is not passed in the New() method is to bypass cycle dependencies when initializing dex backend.
func (*Dexcon) VerifyHeader ¶
VerifyHeader checks whether a header conforms to the consensus rules.
func (*Dexcon) VerifyHeaders ¶
func (d *Dexcon) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers. The method returns a quit channel to abort the operations and a results channel to retrieve the async verifications (the order is that of the input slice).
func (*Dexcon) VerifySeal ¶
VerifySeal implements consensus.Engine, checking whether the signature contained in the header satisfies the consensus protocol requirements.
func (*Dexcon) VerifyUncles ¶
VerifyUncles implements consensus.Engine, always returning an error for any uncles as this consensus mechanism doesn't permit uncles.
type FakeDexcon ¶
type FakeDexcon struct { *Dexcon // contains filtered or unexported fields }
func NewFaker ¶
func NewFaker(nodes *NodeSet) *FakeDexcon
func (*FakeDexcon) Prepare ¶
func (f *FakeDexcon) Prepare(chain consensus.ChainReader, header *types.Header) error
type GovernanceStateFetcher ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) CreateGovTx ¶
func (n *Node) CreateGovTx(nonce uint64, data []byte) *types.Transaction
func (*Node) DKGFinalize ¶
func (n *Node) DKGFinalize(round uint64) *coreTypesDKG.Finalize
func (*Node) DKGMPKReady ¶
func (n *Node) DKGMPKReady(round uint64) *coreTypesDKG.MPKReady
func (*Node) MasterPublicKey ¶
func (n *Node) MasterPublicKey(round uint64) *coreTypesDKG.MasterPublicKey