Documentation ¶
Index ¶
- func ConsensusString(name string, nodes []*snowballNode) string
- type Consensus
- type Directed
- func (dg *Directed) Add(tx Tx) error
- func (dg *Directed) Conflicts(tx Tx) ids.Set
- func (c *Directed) Finalized() bool
- func (c *Directed) HealthCheck() (interface{}, error)
- func (dg *Directed) Initialize(ctx *snow.ConsensusContext, params sbcon.Parameters) error
- func (dg *Directed) IsVirtuous(tx Tx) bool
- func (dg *Directed) Issued(tx Tx) bool
- func (c *Directed) Parameters() sbcon.Parameters
- func (c *Directed) Preferences() ids.Set
- func (c *Directed) Quiesce() bool
- func (dg *Directed) RecordPoll(votes ids.Bag) (bool, error)
- func (dg *Directed) String() string
- func (c *Directed) Virtuous() ids.Set
- type DirectedFactory
- type Factory
- type Input
- func (ig *Input) Add(tx Tx) error
- func (ig *Input) Conflicts(tx Tx) ids.Set
- func (c *Input) Finalized() bool
- func (c *Input) HealthCheck() (interface{}, error)
- func (ig *Input) Initialize(ctx *snow.ConsensusContext, params sbcon.Parameters) error
- func (ig *Input) IsVirtuous(tx Tx) bool
- func (ig *Input) Issued(tx Tx) bool
- func (c *Input) Parameters() sbcon.Parameters
- func (c *Input) Preferences() ids.Set
- func (c *Input) Quiesce() bool
- func (ig *Input) RecordPoll(votes ids.Bag) (bool, error)
- func (ig *Input) String() string
- func (c *Input) Virtuous() ids.Set
- type TestTx
- type Tx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConsensusString ¶ added in v0.8.0
ConsensusString converts a list of snowball nodes into a human-readable string.
Types ¶
type Consensus ¶
type Consensus interface { fmt.Stringer // Takes in the context, alpha, betaVirtuous, and betaRogue Initialize(*snow.ConsensusContext, sbcon.Parameters) error // Returns the parameters that describe this snowstorm instance Parameters() sbcon.Parameters // Returns true if transaction <Tx> is virtuous. // That is, no transaction has been added that conflicts with <Tx> IsVirtuous(Tx) bool // Adds a new transaction to vote on. Returns if a critical error has // occurred. Add(Tx) error // Returns true iff transaction <Tx> has been added Issued(Tx) bool // Returns the set of virtuous transactions // that have not yet been accepted or rejected Virtuous() ids.Set // Returns the currently preferred transactions to be finalized Preferences() ids.Set // Returns the set of transactions conflicting with <Tx> Conflicts(Tx) ids.Set // Collects the results of a network poll. Assumes all transactions // have been previously added. Returns true is any statuses or preferences // changed. Returns if a critical error has occurred. RecordPoll(ids.Bag) (bool, error) // Returns true iff all remaining transactions are rogue. Note, it is // possible that after returning quiesce, a new decision may be added such // that this instance should no longer quiesce. Quiesce() bool // Returns true iff all added transactions have been finalized. Note, it is // possible that after returning finalized, a new decision may be added such // that this instance is no longer finalized. Finalized() bool // HealthCheck returns information about the consensus health. HealthCheck() (interface{}, error) // contains filtered or unexported methods }
Consensus is a snowball instance deciding between an unbounded number of non-transitive conflicts. After performing a network sample of k nodes, you should call collect with the responses.
type Directed ¶
type Directed struct {
// contains filtered or unexported fields
}
Directed is an implementation of a multi-color, non-transitive, snowball instance
func (*Directed) Finalized ¶
func (c *Directed) Finalized() bool
Finalized implements the ConflictGraph interface
func (*Directed) HealthCheck ¶ added in v1.2.2
func (c *Directed) HealthCheck() (interface{}, error)
HealthCheck returns information about the consensus health.
func (*Directed) Initialize ¶
func (dg *Directed) Initialize( ctx *snow.ConsensusContext, params sbcon.Parameters, ) error
Initialize implements the Consensus interface
func (*Directed) IsVirtuous ¶
IsVirtuous implements the Consensus interface
func (*Directed) Parameters ¶
func (c *Directed) Parameters() sbcon.Parameters
Parameters implements the Snowstorm interface
func (*Directed) Preferences ¶
Preferences implements the ConflictGraph interface
func (*Directed) Quiesce ¶
func (c *Directed) Quiesce() bool
Quiesce implements the ConflictGraph interface
func (*Directed) RecordPoll ¶
RecordPoll implements the Consensus interface
type DirectedFactory ¶
type DirectedFactory struct{}
DirectedFactory implements Factory by returning a directed struct
type Factory ¶
type Factory interface {
New() Consensus
}
Factory returns new instances of Consensus
type Input ¶
type Input struct {
// contains filtered or unexported fields
}
Input is an implementation of a multi-color, non-transitive, snowball instance
func (*Input) Finalized ¶
func (c *Input) Finalized() bool
Finalized implements the ConflictGraph interface
func (*Input) HealthCheck ¶ added in v1.2.2
func (c *Input) HealthCheck() (interface{}, error)
HealthCheck returns information about the consensus health.
func (*Input) Initialize ¶
func (ig *Input) Initialize(ctx *snow.ConsensusContext, params sbcon.Parameters) error
Initialize implements the ConflictGraph interface
func (*Input) IsVirtuous ¶
IsVirtuous implements the ConflictGraph interface
func (*Input) Parameters ¶
func (c *Input) Parameters() sbcon.Parameters
Parameters implements the Snowstorm interface
func (*Input) Preferences ¶
Preferences implements the ConflictGraph interface
func (*Input) Quiesce ¶
func (c *Input) Quiesce() bool
Quiesce implements the ConflictGraph interface
func (*Input) RecordPoll ¶
RecordPoll implements the ConflictGraph interface
type TestTx ¶
type TestTx struct { choices.TestDecidable DependenciesV []Tx InputIDsV []ids.ID VerifyV error BytesV []byte }
TestTx is a useful test tx
func (*TestTx) Dependencies ¶
Dependencies implements the Tx interface
type Tx ¶
type Tx interface { choices.Decidable // Dependencies is a list of transactions upon which this transaction // depends. Each element of Dependencies must be verified before Verify is // called on this transaction. // // Similarly, each element of Dependencies must be accepted before this // transaction is accepted. Dependencies() ([]Tx, error) // InputIDs is a set where each element is the ID of a piece of state that // will be consumed if this transaction is accepted. // // In the context of a UTXO-based payments system, for example, this would // be the IDs of the UTXOs consumed by this transaction InputIDs() []ids.ID // Verify that the state transition this transaction would make if it were // accepted is valid. If the state transition is invalid, a non-nil error // should be returned. // // It is guaranteed that when Verify is called, all the dependencies of // this transaction have already been successfully verified. Verify() error // Bytes returns the binary representation of this transaction. // // This is used for sending transactions to peers. Another node should be // able to parse these bytes to the same transaction. Bytes() []byte }
Tx consumes state.