Versions in this module Expand all Collapse all v0 v0.2.0 Apr 1, 2024 Changes in this version + func WithBroadcast[H Hash](f func(m ConsensusPayload[H])) func(config *Config[H]) + func WithCurrentBlockHash[H Hash](f func() H) func(config *Config[H]) + func WithCurrentHeight[H Hash](f func() uint32) func(config *Config[H]) + func WithGetBlock[H Hash](f func(h H) Block[H]) func(config *Config[H]) + func WithGetKeyPair[H Hash](f func(pubs []PublicKey) (int, PrivateKey, PublicKey)) func(config *Config[H]) + func WithGetTx[H Hash](f func(h H) Transaction[H]) func(config *Config[H]) + func WithGetValidators[H Hash](f func(txs ...Transaction[H]) []PublicKey) func(config *Config[H]) + func WithGetVerified[H Hash](f func() []Transaction[H]) func(config *Config[H]) + func WithKeyPair[H Hash](priv PrivateKey, pub PublicKey) func(config *Config[H]) + func WithLogger[H Hash](log *zap.Logger) func(config *Config[H]) + func WithNewBlockFromContext[H Hash](f func(ctx *Context[H]) Block[H]) func(config *Config[H]) + func WithNewChangeView[H Hash](f func(newViewNumber byte, reason ChangeViewReason, ts uint64) ChangeView) func(config *Config[H]) + func WithNewCommit[H Hash](f func(signature []byte) Commit) func(config *Config[H]) + func WithNewConsensusPayload[H Hash](f func(ctx *Context[H], typ MessageType, msg any) ConsensusPayload[H]) func(config *Config[H]) + func WithNewPrepareRequest[H Hash](f func(ts uint64, nonce uint64, transactionsHashes []H) PrepareRequest[H]) func(config *Config[H]) + func WithNewPrepareResponse[H Hash](f func(preparationHash H) PrepareResponse[H]) func(config *Config[H]) + func WithNewRecoveryMessage[H Hash](f func() RecoveryMessage[H]) func(config *Config[H]) + func WithNewRecoveryRequest[H Hash](f func(ts uint64) RecoveryRequest) func(config *Config[H]) + func WithProcessBlock[H Hash](f func(b Block[H])) func(config *Config[H]) + func WithRequestTx[H Hash](f func(h ...H)) func(config *Config[H]) + func WithSecondsPerBlock[H Hash](d time.Duration) func(config *Config[H]) + func WithStopTxFlow[H Hash](f func()) func(config *Config[H]) + func WithTimer[H Hash](t Timer) func(config *Config[H]) + func WithTimestampIncrement[H Hash](u uint64) func(config *Config[H]) + func WithVerifyBlock[H Hash](f func(b Block[H]) bool) func(config *Config[H]) + func WithVerifyPrepareRequest[H Hash](f func(prepareReq ConsensusPayload[H]) error) func(config *Config[H]) + func WithVerifyPrepareResponse[H Hash](f func(prepareResp ConsensusPayload[H]) error) func(config *Config[H]) + func WithWatchOnly[H Hash](f func() bool) func(config *Config[H]) + type Block interface + Hash func() H + Index func() uint32 + MerkleRoot func() H + PrevHash func() H + SetTransactions func([]Transaction[H]) + Sign func(key PrivateKey) error + Signature func() []byte + Transactions func() []Transaction[H] + Verify func(key PublicKey, sign []byte) error + type ChangeView interface + NewViewNumber func() byte + Reason func() ChangeViewReason + type ChangeViewReason byte + const CVBlockRejectedByPolicy + const CVChangeAgreement + const CVTimeout + const CVTxInvalid + const CVTxNotFound + const CVTxRejectedByPolicy + const CVUnknown + func (i ChangeViewReason) String() string + type Commit interface + Signature func() []byte + type Config struct + Broadcast func(m ConsensusPayload[H]) + CurrentBlockHash func() H + CurrentHeight func() uint32 + GetBlock func(h H) Block[H] + GetKeyPair func([]PublicKey) (int, PrivateKey, PublicKey) + GetTx func(h H) Transaction[H] + GetValidators func(...Transaction[H]) []PublicKey + GetVerified func() []Transaction[H] + Logger *zap.Logger + NewBlockFromContext func(ctx *Context[H]) Block[H] + NewChangeView func(newViewNumber byte, reason ChangeViewReason, timestamp uint64) ChangeView + NewCommit func(signature []byte) Commit + NewConsensusPayload func(*Context[H], MessageType, any) ConsensusPayload[H] + NewPrepareRequest func(ts uint64, nonce uint64, transactionHashes []H) PrepareRequest[H] + NewPrepareResponse func(preparationHash H) PrepareResponse[H] + NewRecoveryMessage func() RecoveryMessage[H] + NewRecoveryRequest func(ts uint64) RecoveryRequest + ProcessBlock func(b Block[H]) + RequestTx func(h ...H) + SecondsPerBlock time.Duration + StopTxFlow func() + Timer Timer + TimestampIncrement uint64 + VerifyBlock func(b Block[H]) bool + VerifyPrepareRequest func(p ConsensusPayload[H]) error + VerifyPrepareResponse func(p ConsensusPayload[H]) error + WatchOnly func() bool + type ConsensusMessage interface + GetChangeView func() ChangeView + GetCommit func() Commit + GetPrepareRequest func() PrepareRequest[H] + GetPrepareResponse func() PrepareResponse[H] + GetRecoveryMessage func() RecoveryMessage[H] + GetRecoveryRequest func() RecoveryRequest + Payload func() any + Type func() MessageType + ViewNumber func() byte + type ConsensusPayload interface + Hash func() H + Height func() uint32 + SetValidatorIndex func(i uint16) + ValidatorIndex func() uint16 + type Context struct + BlockIndex uint32 + ChangeViewPayloads []ConsensusPayload[H] + CommitPayloads []ConsensusPayload[H] + Config *Config[H] + LastChangeViewPayloads []ConsensusPayload[H] + LastSeenMessage []*HeightView + MissingTransactions []H + MyIndex int + Nonce uint64 + PreparationPayloads []ConsensusPayload[H] + PrevHash H + PrimaryIndex uint + Priv PrivateKey + Pub PublicKey + Timestamp uint64 + TransactionHashes []H + Transactions map[H]Transaction[H] + Validators []PublicKey + ViewNumber byte + func (c *Context[H]) BlockSent() bool + func (c *Context[H]) CommitSent() bool + func (c *Context[H]) CountCommitted() (count int) + func (c *Context[H]) CountFailed() (count int) + func (c *Context[H]) CreateBlock() Block[H] + func (c *Context[H]) F() int + func (c *Context[H]) Fill() + func (c *Context[H]) GetPrimaryIndex(viewNumber byte) uint + func (c *Context[H]) IsBackup() bool + func (c *Context[H]) IsPrimary() bool + func (c *Context[H]) M() int + func (c *Context[H]) MakeHeader() Block[H] + func (c *Context[H]) MoreThanFNodesCommittedOrLost() bool + func (c *Context[H]) N() int + func (c *Context[H]) NotAcceptingPayloadsDueToViewChanging() bool + func (c *Context[H]) RequestSentOrReceived() bool + func (c *Context[H]) ResponseSent() bool + func (c *Context[H]) ViewChanging() bool + func (c *Context[H]) WatchOnly() bool + type DBFT struct + func New[H Hash](options ...func(config *Config[H])) (*DBFT[H], error) + func (d *DBFT[H]) Header() Block[H] + func (d *DBFT[H]) OnReceive(msg ConsensusPayload[H]) + func (d *DBFT[H]) OnTimeout(height uint32, view byte) + func (d *DBFT[H]) OnTransaction(tx Transaction[H]) + func (d *DBFT[H]) Reset(ts uint64) + func (d *DBFT[H]) Start(ts uint64) + type Hash interface + type HeightView struct + Height uint32 + View byte + type MessageType byte + const ChangeViewType + const CommitType + const PrepareRequestType + const PrepareResponseType + const RecoveryMessageType + const RecoveryRequestType + func (m MessageType) String() string + type PrepareRequest interface + Nonce func() uint64 + Timestamp func() uint64 + TransactionHashes func() []H + type PrepareResponse interface + PreparationHash func() H + type PrivateKey interface + Sign func(msg []byte) (sig []byte, err error) + type PublicKey interface + Verify func(msg, sig []byte) error + type RecoveryMessage interface + AddPayload func(p ConsensusPayload[H]) + GetChangeViews func(p ConsensusPayload[H], validators []PublicKey) []ConsensusPayload[H] + GetCommits func(p ConsensusPayload[H], validators []PublicKey) []ConsensusPayload[H] + GetPrepareRequest func(p ConsensusPayload[H], validators []PublicKey, primary uint16) ConsensusPayload[H] + GetPrepareResponses func(p ConsensusPayload[H], validators []PublicKey) []ConsensusPayload[H] + PreparationHash func() *H + type RecoveryRequest interface + Timestamp func() uint64 + type Timer interface + C func() <-chan time.Time + Extend func(d time.Duration) + Height func() uint32 + Now func() time.Time + Reset func(height uint32, view byte, d time.Duration) + Sleep func(d time.Duration) + Stop func() + View func() byte + type Transaction interface + Hash func() H v0.1.0 May 15, 2023