lstate

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DMan

type DMan struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*DMan) AddTxs

func (dm *DMan) AddTxs(txn *badger.Txn, height uint32, txs []interfaces.Transaction, allowReset bool) error

func (*DMan) DownloadTxs

func (dm *DMan) DownloadTxs(txHshLst [][]byte) bool

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) Status

func (ce *Engine) Status(status map[string]interface{}) (map[string]interface{}, error)

Status .

func (*Engine) Sync

func (ce *Engine) Sync() (bool, error)

Sync .

func (*Engine) UpdateLocalState

func (ce *Engine) UpdateLocalState() (bool, error)

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

func (mb *Handlers) AddNextRound(v *objs.NextRound) error

AddNextRound stores a nextRound object to the database

func (*Handlers) AddPreCommit

func (mb *Handlers) AddPreCommit(v *objs.PreCommit) error

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

func (mb *Handlers) AddPreVote(v *objs.PreVote) error

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

func (mb *Handlers) AddProposal(v *objs.Proposal) error

AddProposal stores a proposal to the database

func (*Handlers) Init

func (mb *Handlers) Init(database *db.Database, dm *DMan) error

Init initializes the Handlers object

func (*Handlers) PreValidate

func (mb *Handlers) PreValidate(v interface{}) error

PreValidate checks a message for validity and performs cryptographic validation

func (*Handlers) Store

func (mb *Handlers) Store(v interface{}) error

Store updates database to include the object; it stores the object.

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)

func (*MockStore) LoadState

func (ss *MockStore) LoadState(txn *badger.Txn, rcert *objs.RCert) (*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

func (*SnapShotManager) Update

func (ndm *SnapShotManager) Update(txn *badger.Txn, snapShotHeight uint32, syncToHeight uint32, stateRoot []byte, hdrRoot []byte, canonicalBlockHash []byte) (bool, error)

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

GetGossipValues ...

func (*Store) GetMaxBH

func (ss *Store) GetMaxBH(txn *badger.Txn) (*objs.BlockHeader, error)

func (*Store) GetSyncToBH

func (ss *Store) GetSyncToBH(txn *badger.Txn) (*objs.BlockHeader, error)

func (*Store) Init

func (ss *Store) Init(database db.DatabaseIface) error

func (*Store) IsSync

func (ss *Store) IsSync(txn *badger.Txn) (bool, 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL