Documentation
¶
Index ¶
- Variables
- type NoopTxResultCache
- type Params
- type Transactions
- func (t *Transactions) GetScheduledTransaction(ctx context.Context, scheduledTxID uint64) (*flow.TransactionBody, error)
- func (t *Transactions) GetScheduledTransactionResult(ctx context.Context, scheduledTxID uint64, ...) (*accessmodel.TransactionResult, error)
- func (t *Transactions) GetSystemTransaction(ctx context.Context, txID flow.Identifier, blockID flow.Identifier) (*flow.TransactionBody, error)
- func (t *Transactions) GetSystemTransactionResult(ctx context.Context, txID flow.Identifier, blockID flow.Identifier, ...) (*accessmodel.TransactionResult, error)
- func (t *Transactions) GetTransaction(ctx context.Context, txID flow.Identifier) (*flow.TransactionBody, error)
- func (t *Transactions) GetTransactionResult(ctx context.Context, txID flow.Identifier, blockID flow.Identifier, ...) (txResult *accessmodel.TransactionResult, err error)
- func (t *Transactions) GetTransactionResultByIndex(ctx context.Context, blockID flow.Identifier, index uint32, ...) (*accessmodel.TransactionResult, error)
- func (t *Transactions) GetTransactionResultsByBlockID(ctx context.Context, blockID flow.Identifier, ...) ([]*accessmodel.TransactionResult, error)
- func (t *Transactions) GetTransactionsByBlockID(ctx context.Context, blockID flow.Identifier) ([]*flow.TransactionBody, error)
- func (t *Transactions) ProcessFinalizedBlockHeight(height uint64) error
- func (t *Transactions) SendRawTransaction(ctx context.Context, tx *flow.TransactionBody) error
- func (t *Transactions) SendTransaction(ctx context.Context, tx *flow.TransactionBody) error
- type TxResultCache
Constants ¶
This section is empty.
Variables ¶
var ErrTransactionNotInBlock = errors.New("transaction not in block")
ErrTransactionNotInBlock represents an error indicating that the transaction is not found in the block.
Functions ¶
This section is empty.
Types ¶
type NoopTxResultCache ¶
type NoopTxResultCache struct{}
NoopTxResultCache is a no-op implementation of the TxResultCache interface.
func NewNoopTxResultCache ¶
func NewNoopTxResultCache() *NoopTxResultCache
NewNoopTxResultCache creates a new no-op implementation of the TxResultCache interface.
func (*NoopTxResultCache) Add ¶
func (n *NoopTxResultCache) Add(flow.Identifier, *accessmodel.TransactionResult) bool
func (*NoopTxResultCache) Get ¶
func (n *NoopTxResultCache) Get(flow.Identifier) (*accessmodel.TransactionResult, bool)
type Params ¶
type Params struct {
Log zerolog.Logger
Metrics module.TransactionMetrics
State protocol.State
ChainID flow.ChainID
SystemCollection *system.SystemCollection
StaticCollectionRPCClient accessproto.AccessAPIClient
HistoricalAccessNodeClients []accessproto.AccessAPIClient
NodeCommunicator node_communicator.Communicator
ConnFactory connection.ConnectionFactory
EnableRetries bool
NodeProvider *rpc.ExecutionNodeIdentitiesProvider
Blocks storage.Blocks
Collections storage.Collections
Transactions storage.Transactions
ScheduledTransactions storage.ScheduledTransactionsReader
TxErrorMessageProvider error_messages.Provider
TxResultCache TxResultCache
TxProvider provider.TransactionProvider
TxValidator *validator.TransactionValidator
TxStatusDeriver *txstatus.TxStatusDeriver
EventsIndex *index.EventsIndex
TxResultsIndex *index.TransactionResultsIndex
ScheduledTransactionsEnabled bool
}
type Transactions ¶
type Transactions struct {
// contains filtered or unexported fields
}
func NewTransactionsBackend ¶
func NewTransactionsBackend(params Params) (*Transactions, error)
func (*Transactions) GetScheduledTransaction ¶
func (t *Transactions) GetScheduledTransaction(ctx context.Context, scheduledTxID uint64) (*flow.TransactionBody, error)
GetScheduledTransaction returns the transaction body of the scheduled transaction by ID.
Expected error returns during normal operation:
- codes.NotFound: if the scheduled transaction is not found
func (*Transactions) GetScheduledTransactionResult ¶
func (t *Transactions) GetScheduledTransactionResult(ctx context.Context, scheduledTxID uint64, encodingVersion entities.EventEncodingVersion) (*accessmodel.TransactionResult, error)
GetScheduledTransactionResult returns the transaction result of the scheduled transaction by ID.
Expected error returns during normal operation:
- codes.NotFound: if the scheduled transaction is not found
func (*Transactions) GetSystemTransaction ¶
func (t *Transactions) GetSystemTransaction( ctx context.Context, txID flow.Identifier, blockID flow.Identifier, ) (*flow.TransactionBody, error)
GetSystemTransaction returns a system transaction by ID. Note: this function only returns privilaged system transactions. It does NOT return user scheduled transactions contained within the system collection.
func (*Transactions) GetSystemTransactionResult ¶
func (t *Transactions) GetSystemTransactionResult( ctx context.Context, txID flow.Identifier, blockID flow.Identifier, encodingVersion entities.EventEncodingVersion, ) (*accessmodel.TransactionResult, error)
GetSystemTransactionResult returns a system transaction result by ID. Note: this function only returns privilaged system transactions. It does NOT return user scheduled transactions contained within the system collection.
func (*Transactions) GetTransaction ¶
func (t *Transactions) GetTransaction(ctx context.Context, txID flow.Identifier) (*flow.TransactionBody, error)
func (*Transactions) GetTransactionResult ¶
func (t *Transactions) GetTransactionResult( ctx context.Context, txID flow.Identifier, blockID flow.Identifier, collectionID flow.Identifier, encodingVersion entities.EventEncodingVersion, ) (txResult *accessmodel.TransactionResult, err error)
func (*Transactions) GetTransactionResultByIndex ¶
func (t *Transactions) GetTransactionResultByIndex( ctx context.Context, blockID flow.Identifier, index uint32, encodingVersion entities.EventEncodingVersion, ) (*accessmodel.TransactionResult, error)
GetTransactionResultByIndex returns transactions Results for an index in a block that is executed, pending or finalized transactions return errors
func (*Transactions) GetTransactionResultsByBlockID ¶
func (t *Transactions) GetTransactionResultsByBlockID( ctx context.Context, blockID flow.Identifier, encodingVersion entities.EventEncodingVersion, ) ([]*accessmodel.TransactionResult, error)
func (*Transactions) GetTransactionsByBlockID ¶
func (t *Transactions) GetTransactionsByBlockID( ctx context.Context, blockID flow.Identifier, ) ([]*flow.TransactionBody, error)
func (*Transactions) ProcessFinalizedBlockHeight ¶
func (t *Transactions) ProcessFinalizedBlockHeight(height uint64) error
ATTENTION: might be a source of problems in future. We run this code on finalization gorotuine, potentially lagging finalization events if operations take long time. We might need to move this logic on dedicated goroutine and provide a way to skip finalization events if they are delivered too often for this engine. An example of similar approach - https://github.com/onflow/flow-go/blob/10b0fcbf7e2031674c00f3cdd280f27bd1b16c47/engine/common/follower/compliance_engine.go#L201.. No errors expected during normal operations.
func (*Transactions) SendRawTransaction ¶
func (t *Transactions) SendRawTransaction( ctx context.Context, tx *flow.TransactionBody, ) error
SendRawTransaction sends a raw transaction to the collection node
func (*Transactions) SendTransaction ¶
func (t *Transactions) SendTransaction(ctx context.Context, tx *flow.TransactionBody) error
SendTransaction forwards the transaction to the collection node
type TxResultCache ¶
type TxResultCache interface {
Get(flow.Identifier) (*accessmodel.TransactionResult, bool)
Add(flow.Identifier, *accessmodel.TransactionResult) bool
}
TxResultCache is a cache for transaction results used by the API to avoid unnecessary lookups on historical access nodes.