Documentation ¶
Index ¶
- type DMan
- func (dm *DMan) AddTxs(txn *badger.Txn, height uint32, txs []interfaces.Transaction, allowReset bool) error
- func (dm *DMan) DownloadTxs(txHshLst [][]byte) bool
- func (dm *DMan) GetTxs(txn *badger.Txn, height uint32, txLst [][]byte) ([]interfaces.Transaction, [][]byte, error)
- func (dm *DMan) Init(database db.DatabaseIface, app appmock.Application, reqBus *request.Client) error
- func (dm *DMan) SyncOneBH(txn *badger.Txn, rs *RoundStates) ([]interfaces.Transaction, *objs.BlockHeader, error)
- type Engine
- func (ce *Engine) AddPendingTx(txn *badger.Txn, d []interfaces.Transaction) error
- func (ce *Engine) Init(database db.DatabaseIface, dm *DMan, app appmock.Application, ...) error
- func (ce *Engine) Status(status map[string]interface{}) (map[string]interface{}, error)
- func (ce *Engine) Sync() (bool, error)
- func (ce *Engine) UpdateLocalState() (bool, error)
- type Handlers
- func (mb *Handlers) AddBlockHeader(v *objs.BlockHeader) error
- func (mb *Handlers) AddNextHeight(v *objs.NextHeight) error
- func (mb *Handlers) AddNextRound(v *objs.NextRound) error
- func (mb *Handlers) AddPreCommit(v *objs.PreCommit) error
- func (mb *Handlers) AddPreCommitNil(v *objs.PreCommitNil) error
- func (mb *Handlers) AddPreVote(v *objs.PreVote) error
- func (mb *Handlers) AddPreVoteNil(v *objs.PreVoteNil) error
- func (mb *Handlers) AddProposal(v *objs.Proposal) error
- func (mb *Handlers) Init(database *db.Database, dm *DMan) error
- func (mb *Handlers) PreValidate(v interface{}) error
- func (mb *Handlers) Store(v interface{}) error
- type MockStore
- type RoundStates
- func (r *RoundStates) ChainID() uint32
- func (r *RoundStates) GetCurrentNext() (objs.NextHeightList, objs.NextRoundList, error)
- func (r *RoundStates) GetCurrentPreCommits() (objs.PreCommitList, objs.PreCommitNilList, error)
- func (r *RoundStates) GetCurrentPreVotes() (objs.PreVoteList, objs.PreVoteNilList, error)
- func (r *RoundStates) GetCurrentProposal() *objs.Proposal
- func (r *RoundStates) GetCurrentThreshold() int
- func (r *RoundStates) GetRoundState(vAddr []byte) *objs.RoundState
- func (r *RoundStates) Height() uint32
- func (r *RoundStates) IsCurrentValidator() bool
- func (r *RoundStates) IsMe(vAddr []byte) bool
- func (r *RoundStates) LocalIsProposer() bool
- func (r *RoundStates) LocalPreCommitCurrent() bool
- func (r *RoundStates) LocalPreVoteCurrent() bool
- func (r *RoundStates) LockedValue() *objs.Proposal
- func (r *RoundStates) LockedValueCurrent() bool
- func (r *RoundStates) OwnRoundState() *objs.RoundState
- func (r *RoundStates) PrevBlock() []byte
- func (r *RoundStates) RCert() *objs.RCert
- func (r *RoundStates) Round() uint32
- func (r *RoundStates) SetNextHeight(pc *objs.NextHeight) error
- func (r *RoundStates) SetNextRound(pc *objs.NextRound) error
- func (r *RoundStates) SetPreCommit(pc *objs.PreCommit) error
- func (r *RoundStates) SetPreCommitNil(pcn *objs.PreCommitNil) error
- func (r *RoundStates) SetPreVote(pv *objs.PreVote) error
- func (r *RoundStates) SetPreVoteNil(pvn *objs.PreVoteNil) error
- func (r *RoundStates) SetProposal(p *objs.Proposal) error
- func (r *RoundStates) ValidValue() *objs.Proposal
- func (r *RoundStates) ValidValueCurrent() bool
- type SnapShotManager
- type Store
- func (ss *Store) GetDropData(txn *badger.Txn) (isValidator bool, isSync bool, chainID uint32, height uint32, round uint32, ...)
- func (ss *Store) GetGossipValues() (*objs.Proposal, *objs.PreVote, *objs.PreVoteNil, *objs.PreCommit, ...)
- func (ss *Store) GetMaxBH(txn *badger.Txn) (*objs.BlockHeader, error)
- func (ss *Store) GetSyncToBH(txn *badger.Txn) (*objs.BlockHeader, error)
- func (ss *Store) Init(database db.DatabaseIface) error
- func (ss *Store) IsSync(txn *badger.Txn) (bool, error)
- func (ss *Store) LoadLocalState(txn *badger.Txn) (*RoundStates, error)
- func (ss *Store) LoadState(txn *badger.Txn, rcert *objs.RCert) (*RoundStates, error)
- func (ss *Store) WriteState(rs *RoundStates) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DMan ¶
func (*DMan) AddTxs ¶
func (dm *DMan) AddTxs(txn *badger.Txn, height uint32, txs []interfaces.Transaction, allowReset bool) error
func (*DMan) DownloadTxs ¶
func (*DMan) GetTxs ¶
func (dm *DMan) GetTxs(txn *badger.Txn, height uint32, txLst [][]byte) ([]interfaces.Transaction, [][]byte, error)
func (*DMan) Init ¶
func (dm *DMan) Init(database db.DatabaseIface, app appmock.Application, reqBus *request.Client) error
func (*DMan) SyncOneBH ¶
func (dm *DMan) SyncOneBH(txn *badger.Txn, rs *RoundStates) ([]interfaces.Transaction, *objs.BlockHeader, error)
SyncOneBH syncs one blockheader and its transactions the initialization of prevBH from SyncToBH implies SyncToBH must be updated to the canonical bh before we begin unless we are syncing from a height gt the canonical bh
type Engine ¶
type Engine struct { RequestBus *request.Client AdminBus *admin.Handlers EthPubk []byte // contains filtered or unexported fields }
Engine is the consensus algorithm parent object.
func (*Engine) AddPendingTx ¶
func (ce *Engine) AddPendingTx(txn *badger.Txn, d []interfaces.Transaction) error
AddPendingTx ...
func (*Engine) Init ¶
func (ce *Engine) Init(database db.DatabaseIface, dm *DMan, app appmock.Application, signer *crypto.Secp256k1Signer, adminHandlers *admin.Handlers, publicKey []byte, rbusClient *request.Client) error
Init will initialize the Consensus Engine and all sub modules
func (*Engine) UpdateLocalState ¶
UpdateLocalState .
type Handlers ¶
type Handlers struct {
// contains filtered or unexported fields
}
func (*Handlers) AddBlockHeader ¶
func (mb *Handlers) AddBlockHeader(v *objs.BlockHeader) error
AddBlockHeader stores a blockHeader object to the database
func (*Handlers) AddNextHeight ¶
func (mb *Handlers) AddNextHeight(v *objs.NextHeight) error
AddNextHeight stores a nextHeight object to the database
func (*Handlers) AddNextRound ¶
AddNextRound stores a nextRound object to the database
func (*Handlers) AddPreCommit ¶
AddPreCommit stores a preCommit to the database
func (*Handlers) AddPreCommitNil ¶
func (mb *Handlers) AddPreCommitNil(v *objs.PreCommitNil) error
AddPreCommitNil stores a preCommitNil to the database
func (*Handlers) AddPreVote ¶
AddPreVote stores a preVote to the database
func (*Handlers) AddPreVoteNil ¶
func (mb *Handlers) AddPreVoteNil(v *objs.PreVoteNil) error
AddPreVoteNil stores a preVoteNil to the database
func (*Handlers) AddProposal ¶
AddProposal stores a proposal to the database
func (*Handlers) PreValidate ¶
PreValidate checks a message for validity and performs cryptographic validation
type MockStore ¶
type MockStore struct {
// contains filtered or unexported fields
}
MockStore .
func NewMockStore ¶
func NewMockStore(mdb *db.MockDatabaseIface) *MockStore
func (*MockStore) LoadLocalState ¶
func (ss *MockStore) LoadLocalState(txn *badger.Txn) (*RoundStates, error)
type RoundStates ¶
type RoundStates struct { OwnState *objs.OwnState ValidatorSet *objs.ValidatorSet OwnValidatingState *objs.OwnValidatingState PeerStateMap map[string]*objs.RoundState // contains filtered or unexported fields }
func (*RoundStates) ChainID ¶
func (r *RoundStates) ChainID() uint32
func (*RoundStates) GetCurrentNext ¶
func (r *RoundStates) GetCurrentNext() (objs.NextHeightList, objs.NextRoundList, error)
func (*RoundStates) GetCurrentPreCommits ¶
func (r *RoundStates) GetCurrentPreCommits() (objs.PreCommitList, objs.PreCommitNilList, error)
func (*RoundStates) GetCurrentPreVotes ¶
func (r *RoundStates) GetCurrentPreVotes() (objs.PreVoteList, objs.PreVoteNilList, error)
func (*RoundStates) GetCurrentProposal ¶
func (r *RoundStates) GetCurrentProposal() *objs.Proposal
func (*RoundStates) GetCurrentThreshold ¶
func (r *RoundStates) GetCurrentThreshold() int
func (*RoundStates) GetRoundState ¶
func (r *RoundStates) GetRoundState(vAddr []byte) *objs.RoundState
func (*RoundStates) Height ¶
func (r *RoundStates) Height() uint32
func (*RoundStates) IsCurrentValidator ¶
func (r *RoundStates) IsCurrentValidator() bool
func (*RoundStates) IsMe ¶
func (r *RoundStates) IsMe(vAddr []byte) bool
func (*RoundStates) LocalIsProposer ¶
func (r *RoundStates) LocalIsProposer() bool
func (*RoundStates) LocalPreCommitCurrent ¶
func (r *RoundStates) LocalPreCommitCurrent() bool
func (*RoundStates) LocalPreVoteCurrent ¶
func (r *RoundStates) LocalPreVoteCurrent() bool
func (*RoundStates) LockedValue ¶
func (r *RoundStates) LockedValue() *objs.Proposal
func (*RoundStates) LockedValueCurrent ¶
func (r *RoundStates) LockedValueCurrent() bool
func (*RoundStates) OwnRoundState ¶
func (r *RoundStates) OwnRoundState() *objs.RoundState
func (*RoundStates) PrevBlock ¶
func (r *RoundStates) PrevBlock() []byte
func (*RoundStates) RCert ¶
func (r *RoundStates) RCert() *objs.RCert
func (*RoundStates) Round ¶
func (r *RoundStates) Round() uint32
func (*RoundStates) SetNextHeight ¶
func (r *RoundStates) SetNextHeight(pc *objs.NextHeight) error
func (*RoundStates) SetNextRound ¶
func (r *RoundStates) SetNextRound(pc *objs.NextRound) error
func (*RoundStates) SetPreCommit ¶
func (r *RoundStates) SetPreCommit(pc *objs.PreCommit) error
func (*RoundStates) SetPreCommitNil ¶
func (r *RoundStates) SetPreCommitNil(pcn *objs.PreCommitNil) error
func (*RoundStates) SetPreVote ¶
func (r *RoundStates) SetPreVote(pv *objs.PreVote) error
func (*RoundStates) SetPreVoteNil ¶
func (r *RoundStates) SetPreVoteNil(pvn *objs.PreVoteNil) error
func (*RoundStates) SetProposal ¶
func (r *RoundStates) SetProposal(p *objs.Proposal) error
func (*RoundStates) ValidValue ¶
func (r *RoundStates) ValidValue() *objs.Proposal
func (*RoundStates) ValidValueCurrent ¶
func (r *RoundStates) ValidValueCurrent() bool
type SnapShotManager ¶
type SnapShotManager struct {
// contains filtered or unexported fields
}
func (*SnapShotManager) Init ¶
func (ndm *SnapShotManager) Init(database db.DatabaseIface) error
Init initializes the SnapShotManager
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) GetDropData ¶
func (ss *Store) GetDropData(txn *badger.Txn) (isValidator bool, isSync bool, chainID uint32, height uint32, round uint32, err error)
GetDropData ...
func (*Store) GetGossipValues ¶
func (ss *Store) GetGossipValues() (*objs.Proposal, *objs.PreVote, *objs.PreVoteNil, *objs.PreCommit, *objs.PreCommitNil, *objs.NextRound, *objs.NextHeight, error)
GetGossipValues ...
func (*Store) GetSyncToBH ¶
func (ss *Store) GetSyncToBH(txn *badger.Txn) (*objs.BlockHeader, error)
func (*Store) LoadLocalState ¶
func (ss *Store) LoadLocalState(txn *badger.Txn) (*RoundStates, error)
func (*Store) LoadState ¶
func (ss *Store) LoadState(txn *badger.Txn, rcert *objs.RCert) (*RoundStates, error)
func (*Store) WriteState ¶
func (ss *Store) WriteState(rs *RoundStates) error