data

package
v0.0.0-...-0bc3d7e Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidLedger = errors.New("MakeTxHandler: ledger is nil on initialization")

ErrInvalidLedger is reported when nil is passed for the ledger

View Source
var ErrInvalidTxPool = errors.New("MakeTxHandler: txPool is nil on initialization")

ErrInvalidTxPool is reported when nil is passed for the tx pool

Functions

This section is empty.

Types

type AccountManager

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

AccountManager loads and manages accounts for the node

func MakeAccountManager

func MakeAccountManager(log logging.Logger, registry account.ParticipationRegistry) *AccountManager

MakeAccountManager creates a new AccountManager with a custom logger

func (*AccountManager) AddParticipation

func (manager *AccountManager) AddParticipation(participation account.PersistedParticipation, ephemeral bool) bool

AddParticipation adds a new account.Participation to be managed. The return value indicates if the key has been added (true) or if this is a duplicate key (false). if ephemeral is true then the key is not stored in the internal hashmap and will not be deleted by DeleteOldKeys()

func (*AccountManager) DeleteOldKeys

func (manager *AccountManager) DeleteOldKeys(latestHdr bookkeeping.BlockHeader, agreementProto config.ConsensusParams)

DeleteOldKeys deletes all accounts' ephemeral keys strictly older than the next round needed for each account.

func (*AccountManager) DeleteStateProofKey

func (manager *AccountManager) DeleteStateProofKey(id account.ParticipationID, round basics.Round) error

DeleteStateProofKey deletes keys related to a ParticipationID. The function removes all keys up to, and not including, the given round.

func (*AccountManager) HasLiveKeys

func (manager *AccountManager) HasLiveKeys(from, to basics.Round) bool

HasLiveKeys returns true if we have any Participation keys valid for the specified round range (inclusive)

func (*AccountManager) Keys

func (manager *AccountManager) Keys(rnd basics.Round) (out []account.ParticipationRecordForRound)

Keys returns a list of Participation accounts, and their keys/secrets for requested round.

func (*AccountManager) Record

func (manager *AccountManager) Record(account basics.Address, round basics.Round, participationType account.ParticipationAction)

Record asynchronously records a participation key usage event.

func (*AccountManager) Registry

func (manager *AccountManager) Registry() account.ParticipationRegistry

Registry fetches the ParticipationRegistry.

func (*AccountManager) StateProofKeys

func (manager *AccountManager) StateProofKeys(rnd basics.Round) (out []account.StateProofSecretsForRound)

StateProofKeys returns a list of Participation accounts, and their stateproof secrets

type HybridRelayer

type HybridRelayer interface {
	BridgeP2PToWS(ctx context.Context, tag protocol.Tag, data []byte, wait bool, except network.Peer) error
}

HybridRelayer is an interface for relaying p2p transactions to WS network

type Ledger

type Ledger struct {
	*ledger.Ledger
	// contains filtered or unexported fields
}

The Ledger object in this (data) package provides a wrapper around the Ledger from the ledger package. The reason for this is compatibility with the existing callers of the previous ledger API, without increasing the complexity of the ledger.Ledger code. This Ledger object also implements various wrappers that return subsets of data exposed by ledger.Ledger, or return it in different forms, or return it for the latest round (as opposed to arbitrary rounds).

func LoadLedger

func LoadLedger[T string | ledger.DirsAndPrefix](
	log logging.Logger, dir T, memory bool,
	genesisProto protocol.ConsensusVersion, genesisBal bookkeeping.GenesisBalances, genesisID string, genesisHash crypto.Digest,
	cfg config.Local,
) (*Ledger, error)

LoadLedger creates a Ledger object to represent the ledger with the specified database file prefix, initializing it if necessary.

func (*Ledger) AddressTxns

func (l *Ledger) AddressTxns(id basics.Address, r basics.Round) ([]transactions.SignedTxnWithAD, error)

AddressTxns returns the list of transactions to/from a given address in specific round

func (*Ledger) Circulation

func (l *Ledger) Circulation(r basics.Round, voteRnd basics.Round) (basics.MicroAlgos, error)

Circulation implements agreement.Ledger.Circulation.

func (*Ledger) ConsensusParams

func (l *Ledger) ConsensusParams(r basics.Round) (config.ConsensusParams, error)

ConsensusParams gives the consensus parameters agreed on in a given round, returning an error if we don't have that round or we have an I/O error. Implements agreement.Ledger.ConsensusParams

func (*Ledger) ConsensusVersion

func (l *Ledger) ConsensusVersion(r basics.Round) (protocol.ConsensusVersion, error)

ConsensusVersion gives the consensus version agreed on in a given round, returning an error if the consensus version could not be figured using either the block header for the given round, or the latest block header. Implements agreement.Ledger.ConsensusVersion

func (*Ledger) EnsureBlock

func (l *Ledger) EnsureBlock(block *bookkeeping.Block, c agreement.Certificate)

EnsureBlock ensures that the block, and associated certificate c, are written to the ledger, or that some other block for the same round is written to the ledger. This function can be called concurrently.

func (*Ledger) EnsureValidatedBlock

func (l *Ledger) EnsureValidatedBlock(vb *ledgercore.ValidatedBlock, c agreement.Certificate)

EnsureValidatedBlock ensures that the block, and associated certificate c, are written to the ledger, or that some other block for the same round is written to the ledger.

func (*Ledger) LastRound

func (l *Ledger) LastRound() basics.Round

LastRound returns the local latest round of the network i.e. the *last* written block

func (*Ledger) LookupDigest

func (l *Ledger) LookupDigest(r basics.Round) (crypto.Digest, error)

LookupDigest gives the block hash that was agreed on in a given round, returning an error if we don't have that round or we have an I/O error. Implements agreement.Ledger.LookupDigest

func (*Ledger) LookupTxid

func (l *Ledger) LookupTxid(txid transactions.Txid, r basics.Round) (stxn transactions.SignedTxnWithAD, found bool, err error)

LookupTxid returns the transaction with a given ID in a specific round

func (*Ledger) NextRound

func (l *Ledger) NextRound() basics.Round

NextRound returns the *next* block to write i.e. latest() + 1 Implements agreement.Ledger.NextRound

func (*Ledger) Seed

func (l *Ledger) Seed(r basics.Round) (committee.Seed, error)

Seed gives the VRF seed that was agreed on in a given round, returning an error if we don't have that round or we have an I/O error. Implements agreement.Ledger.Seed

type SolicitedTxHandler

type SolicitedTxHandler interface {
	Handle(txgroup []transactions.SignedTxn) error
}

SolicitedTxHandler handles messages received through channels other than the gossip network. It therefore circumvents the notion of incoming/outgoing messages

type TxHandler

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

TxHandler handles transaction messages

func MakeTxHandler

func MakeTxHandler(opts TxHandlerOpts) (*TxHandler, error)

MakeTxHandler makes a new handler for transaction messages

func (*TxHandler) LocalTransaction

func (handler *TxHandler) LocalTransaction(txgroup []transactions.SignedTxn) error

LocalTransaction is a special shortcut handler for local transactions and intended to be used for performance testing and debugging purposes only since it does not have congestion control and duplicates detection.

func (*TxHandler) SolicitedTxHandler

func (handler *TxHandler) SolicitedTxHandler() SolicitedTxHandler

SolicitedTxHandler converts a transaction handler to a SolicitedTxHandler

func (*TxHandler) Start

func (handler *TxHandler) Start()

Start enables the processing of incoming messages at the transaction handler

func (*TxHandler) Stop

func (handler *TxHandler) Stop()

Stop suspends the processing of incoming messages at the transaction handler

type TxHandlerOpts

type TxHandlerOpts struct {
	TxPool        *pools.TransactionPool
	ExecutionPool execpool.BacklogPool
	Ledger        *Ledger
	Net           network.GossipNode
	GenesisID     string
	GenesisHash   crypto.Digest
	Config        config.Local
}

TxHandlerOpts is TxHandler configuration options

Jump to

Keyboard shortcuts

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