Documentation ¶
Index ¶
- Variables
- type BlockThresholdTranslation
- type ConflictThresholdTranslation
- type Gadget
- func (s *Gadget) Events() *tangleold.ConfirmationEvents
- func (s *Gadget) FirstUnconfirmedMarkerIndex(sequenceID markers.SequenceID) (index markers.Index)
- func (s *Gadget) HandleConflict(conflictID utxo.TransactionID, aw float64) (err error)
- func (s *Gadget) HandleMarker(marker markers.Marker, aw float64) (err error)
- func (s *Gadget) IsBlockConfirmed(blkID tangleold.BlockID) (confirmed bool)
- func (s *Gadget) IsConflictConfirmed(conflictID utxo.TransactionID) (confirmed bool)
- func (s *Gadget) IsMarkerConfirmed(marker markers.Marker) (confirmed bool)
- func (s *Gadget) IsTransactionConfirmed(transactionID utxo.TransactionID) (confirmed bool)
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultConflictTranslation is the default function to translate the approval weight to confirmation.State of a conflict. DefaultConflictTranslation ConflictThresholdTranslation = func(_ utxo.TransactionID, aw float64) confirmation.State { if aw >= acceptanceThreshold { return confirmation.Accepted } return confirmation.Pending } // DefaultBlockTranslation is the default function to translate the approval weight to confirmation.State of a block. DefaultBlockTranslation BlockThresholdTranslation = func(aw float64) confirmation.State { if aw >= acceptanceThreshold { return confirmation.Accepted } return confirmation.Pending } )
Functions ¶
This section is empty.
Types ¶
type BlockThresholdTranslation ¶
type BlockThresholdTranslation func(aw float64) confirmation.State
BlockThresholdTranslation is a function which translates approval weight to a confirmation.State.
type ConflictThresholdTranslation ¶
type ConflictThresholdTranslation func(conflictID utxo.TransactionID, aw float64) confirmation.State
ConflictThresholdTranslation is a function which translates approval weight to a confirmation.State.
type Gadget ¶
type Gadget struct {
// contains filtered or unexported fields
}
Gadget is a GadgetInterface which simply translates approval weight down to confirmation.State and then applies it to blocks, conflicts, transactions and outputs.
func NewSimpleFinalityGadget ¶
NewSimpleFinalityGadget creates a new Gadget.
func (*Gadget) Events ¶
func (s *Gadget) Events() *tangleold.ConfirmationEvents
Events returns the events this gadget exposes.
func (*Gadget) FirstUnconfirmedMarkerIndex ¶
func (s *Gadget) FirstUnconfirmedMarkerIndex(sequenceID markers.SequenceID) (index markers.Index)
FirstUnconfirmedMarkerIndex returns the first Index in the given Sequence that was not confirmed, yet.
func (*Gadget) HandleConflict ¶
func (s *Gadget) HandleConflict(conflictID utxo.TransactionID, aw float64) (err error)
HandleConflict receives a conflictID and its approval weight. It propagates the ConfirmationState according to AW to transactions in the conflict (UTXO future cone) and their outputs.
func (*Gadget) HandleMarker ¶
HandleMarker receives a marker and its current approval weight. It propagates the ConfirmationState according to AW to its past cone.
func (*Gadget) IsBlockConfirmed ¶
IsBlockConfirmed returns whether the given block is confirmed.
func (*Gadget) IsConflictConfirmed ¶
func (s *Gadget) IsConflictConfirmed(conflictID utxo.TransactionID) (confirmed bool)
IsConflictConfirmed returns whether the given conflict is confirmed.
func (*Gadget) IsMarkerConfirmed ¶
IsMarkerConfirmed returns whether the given marker is confirmed.
func (*Gadget) IsTransactionConfirmed ¶
func (s *Gadget) IsTransactionConfirmed(transactionID utxo.TransactionID) (confirmed bool)
IsTransactionConfirmed returns whether the given transaction is confirmed.
type Option ¶
type Option func(*Options)
Option is a function setting an option on an Options struct.
func WithBlockThresholdTranslation ¶
func WithBlockThresholdTranslation(f BlockThresholdTranslation) Option
WithBlockThresholdTranslation returns an Option setting the BlockThresholdTranslation.
func WithConflictThresholdTranslation ¶
func WithConflictThresholdTranslation(f ConflictThresholdTranslation) Option
WithConflictThresholdTranslation returns an Option setting the ConflictThresholdTranslation.
type Options ¶
type Options struct { ConflictTransFunc ConflictThresholdTranslation BlockTransFunc BlockThresholdTranslation }
Options defines the options for a Gadget.