Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = Config{ BlockTxLimit: 400, TxWaitTime: 1 * time.Second, BeatTimeout: 500 * time.Millisecond, BlockDelay: 40 * time.Millisecond, ViewWidth: 30 * time.Second, LeaderTimeout: 10 * time.Second, }
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ChainID int64 // maximum tx count in a block BlockTxLimit int // block creation delay if no transactions in the pool TxWaitTime time.Duration // for leader, delay to propose next block if she cannot create qc") BeatTimeout time.Duration // minimum delay between each block (i.e, it can define maximum block rate) BlockDelay time.Duration // view duration for a leader ViewWidth time.Duration // leader must create next qc within this duration LeaderTimeout time.Duration }
type Execution ¶
type Execution interface {
Execute(blk *core.Block, txs []*core.Transaction) (*core.BlockCommit, []*core.TxCommit)
}
type MsgService ¶
type MsgService interface { BroadcastProposal(blk *core.Block) error BroadcastNewView(qc *core.QuorumCert) error SendVote(pubKey *core.PublicKey, vote *core.Vote) error RequestBlock(pubKey *core.PublicKey, hash []byte) (*core.Block, error) RequestBlockByHeight(pubKey *core.PublicKey, height uint64) (*core.Block, error) SendNewView(pubKey *core.PublicKey, qc *core.QuorumCert) error SubscribeProposal(buffer int) *emitter.Subscription SubscribeVote(buffer int) *emitter.Subscription SubscribeNewView(buffer int) *emitter.Subscription }
type Resources ¶
type Resources struct { Signer core.Signer VldStore core.ValidatorStore Storage Storage MsgSvc MsgService TxPool TxPool Execution Execution }
type Status ¶
type Status struct { StartTime int64 // commited tx count since node is up CommitedTxCount int BlockPoolSize int QCPoolSize int // start timestamp of current view ViewStart int64 // set to true when current view timeout // set to false once the view leader created the first qc PendingViewChange bool LeaderIndex int // hotstuff state (block heights) BVote uint64 BLock uint64 BExec uint64 BLeaf uint64 QCHigh uint64 }
type TxPool ¶
type TxPool interface { PopTxsFromQueue(max int) [][]byte SetTxsPending(hashes [][]byte) GetTxsToExecute(hashes [][]byte) ([]*core.Transaction, [][]byte) RemoveTxs(hashes [][]byte) PutTxsToQueue(hashes [][]byte) SyncTxs(peer *core.PublicKey, hashes [][]byte) error GetTx(hash []byte) *core.Transaction GetStatus() txpool.Status }
Click to show internal directories.
Click to hide internal directories.