branches

package
v0.6.2-testnet Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package branches implements caching of branch data

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Branches

type Branches struct {
	// contains filtered or unexported fields
}

func New

func New(env environment) *Branches

func (*Branches) BranchKnowsTransaction

func (b *Branches) BranchKnowsTransaction(branchID, txid base.TransactionID) bool

func (*Branches) ChainLines

func (b *Branches) ChainLines(tipOrig base.TransactionID, prefix ...string) *lines.Lines

ChainLines for debugging

func (*Branches) Get

func (b *Branches) Get(branchTxID base.TransactionID) *multistate.BranchData

func (*Branches) GetStateReaderForTheBranch

func (b *Branches) GetStateReaderForTheBranch(branchID base.TransactionID) multistate.IndexedStateReader

GetStateReaderForTheBranch returns a state reader for the branch or nil if the state does not exist. If the branch is before the snapshot and branch ChainID is known in the snapshot state, it returns the snapshot state (which always exists)

func (*Branches) IsDescendantBranch

func (b *Branches) IsDescendantBranch(descendant, ancestor base.TransactionID) (sameLineage bool, isDescendant bool)

IsDescendantBranch returns:

compatible = true -> then isDescendentOf=true if branch1 known branch2 and false otherwise
compatible = false -> branches not in the same chain and isDescendentOf is undefined

func (*Branches) LedgerCoverage

func (b *Branches) LedgerCoverage(branchID base.TransactionID) uint64

LedgerCoverage strictly speaking, is non-deterministic if the snapshot is after the genesis However:

  • if branchID is far enough (63 slots), it is guaranteed to be the real value and therefore deterministic
  • if the snapshot is N slots behind the branchID, it is guaranteed that the returned value differs from the real value no more than by 1/2^N

func (*Branches) SequencerOutputID

func (b *Branches) SequencerOutputID(branchID base.TransactionID) (base.OutputID, bool)

func (*Branches) SnapshotBranchID

func (b *Branches) SnapshotBranchID() base.TransactionID

func (*Branches) SnapshotKnowsTransaction

func (b *Branches) SnapshotKnowsTransaction(txid base.TransactionID) bool

func (*Branches) SnapshotSlot

func (b *Branches) SnapshotSlot() uint32

func (*Branches) Supply

func (b *Branches) Supply(branchID base.TransactionID) uint64

func (*Branches) TransactionIsInSnapshotState

func (b *Branches) TransactionIsInSnapshotState(txid base.TransactionID) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL