Documentation ¶
Index ¶
- type ConflictResolver
- func (o *ConflictResolver) AdjustOpinion(conflictID utxo.TransactionID) (likedConflict utxo.TransactionID, dislikedConflicts utxo.TransactionIDs)
- func (o *ConflictResolver) ConflictLiked(conflict *conflictdag.Conflict[utxo.TransactionID, utxo.OutputID]) (conflictLiked bool)
- func (o *ConflictResolver) ForEachConnectedConflictingConflictInDescendingOrder(conflict *conflictdag.Conflict[utxo.TransactionID, utxo.OutputID], ...)
- type WeightFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConflictResolver ¶
type ConflictResolver struct {
// contains filtered or unexported fields
}
ConflictResolver is a generalized form of Nakamoto consensus for the parallel-reality-based ledger state where the heaviest conflict according to approval weight is liked by any given node.
func New ¶
func New(conflictDAG *conflictdag.ConflictDAG[utxo.TransactionID, utxo.OutputID], weightFunc WeightFunc) *ConflictResolver
New is the constructor for ConflictResolver.
func (*ConflictResolver) AdjustOpinion ¶
func (o *ConflictResolver) AdjustOpinion(conflictID utxo.TransactionID) (likedConflict utxo.TransactionID, dislikedConflicts utxo.TransactionIDs)
AdjustOpinion returns the reference that is necessary to correct our opinion on the given conflict. It recursively walk to the parent conflicts to find the upmost liked conflict.
func (*ConflictResolver) ConflictLiked ¶
func (o *ConflictResolver) ConflictLiked(conflict *conflictdag.Conflict[utxo.TransactionID, utxo.OutputID]) (conflictLiked bool)
ConflictLiked returns whether the conflict is the winner across all conflict sets (it is in the liked reality).
func (*ConflictResolver) ForEachConnectedConflictingConflictInDescendingOrder ¶
func (o *ConflictResolver) ForEachConnectedConflictingConflictInDescendingOrder(conflict *conflictdag.Conflict[utxo.TransactionID, utxo.OutputID], callback func(conflict *conflictdag.Conflict[utxo.TransactionID, utxo.OutputID]))
ForEachConnectedConflictingConflictInDescendingOrder iterates over all conflicts connected via conflict sets and sorts them by weight. It calls the callback for each of them in that order.
type WeightFunc ¶
type WeightFunc func(conflictID utxo.TransactionID) (weight int64)