transactions

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(db sql.Executor, tx *types.Transaction, received time.Time) error

Add transaction to the database or update the header if it wasn't set originally.

func AddResult

AddResult adds result for the transaction.

func AddToBlock

func AddToBlock(db sql.Executor, tid types.TransactionID, lid types.LayerID, bid types.BlockID) error

AddToBlock associates a transaction with a block.

func AddToProposal

func AddToProposal(db sql.Executor, tid types.TransactionID, lid types.LayerID, pid types.ProposalID) error

AddToProposal associates a transaction with a proposal.

func AddressesWithPendingTransactions

func AddressesWithPendingTransactions(db sql.Executor) ([]types.AddressNonce, error)

AddressesWithPendingTransactions returns list of addresses with pending transactions. Query is expensive, meant to be used only on startup.

func DeleteProposalTxsBefore added in v1.1.10

func DeleteProposalTxsBefore(db sql.Executor, lid types.LayerID) error

func Get

func Get(db sql.Executor, id types.TransactionID) (tx *types.MeshTransaction, err error)

Get gets a transaction from database. Layer and Block fields are set if transaction was applied. If transaction is included, but not applied check references in proposals and blocks.

func GetAcctPendingFromNonce

func GetAcctPendingFromNonce(db sql.Executor, address types.Address, from uint64) ([]*types.MeshTransaction, error)

GetAcctPendingFromNonce get all pending transactions with nonce after `from` for the given address.

func GetAppliedLayer

func GetAppliedLayer(db sql.Executor, tid types.TransactionID) (types.LayerID, error)

GetAppliedLayer returns layer when transaction was applied.

func GetBlobSizes added in v1.4.1

func GetBlobSizes(db sql.Executor, ids [][]byte) (sizes []int, err error)

GetBlobSizes returns the sizes of the blobs corresponding to the transactions with specified ids. For non-existent transactions, the corresponding items are set to -1.

func GetByAddress

func GetByAddress(db sql.Executor, from, to types.LayerID, address types.Address) ([]*types.MeshTransaction, error)

GetByAddress finds all transactions for an address.

func Has

func Has(db sql.Executor, id types.TransactionID) (bool, error)

Has returns true if transaction is stored in the database.

func HasBlockTX

func HasBlockTX(db sql.Executor, bid types.BlockID, tid types.TransactionID) (bool, error)

HasBlockTX returns true if the given transaction is included in the given block.

func HasProposalTX

func HasProposalTX(db sql.Executor, pid types.ProposalID, tid types.TransactionID) (bool, error)

HasProposalTX returns true if the given transaction is included in the given proposal.

func IterateResults

func IterateResults(db sql.Executor, filter ResultsFilter, fn func(*types.TransactionWithResult) bool) error

IterateResults allows to control iteration by the output of `fn`.

func IterateTransactionsOps added in v1.6.0

func IterateTransactionsOps(
	db sql.Executor,
	operations builder.Operations,
	fn func(tx *types.MeshTransaction, result *types.TransactionResult) bool,
) error

func LoadBlob added in v1.4.1

func LoadBlob(ctx context.Context, db sql.Executor, id []byte, blob *sql.Blob) error

LoadBlob loads transaction as an encoded blob, ready to be sent over the wire.

func TransactionInBlock

func TransactionInBlock(
	db sql.Executor,
	id types.TransactionID,
	after types.LayerID,
) (types.BlockID, types.LayerID, error)

TransactionInBlock returns lowest layer and id of the block where tx is included after the specified layer.

func TransactionInProposal

func TransactionInProposal(db sql.Executor, id types.TransactionID, after types.LayerID) (types.LayerID, error)

TransactionInProposal returns lowest layer of the proposal where tx is included after the specified layer.

func UndoLayers

func UndoLayers(tx sql.Transaction, from types.LayerID) error

UndoLayers unset all transactions to `statePending` from `from` layer to the max layer with applied transactions.

Types

type ResultsFilter

type ResultsFilter struct {
	Address    *types.Address
	Start, End *types.LayerID
	TID        *types.TransactionID
}

ResultsFilter applies filter on transaction results query.

Jump to

Keyboard shortcuts

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