txs

package
v0.0.0-...-9e22ca1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: GPL-3.0, LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent[T THash] interface {
	Execute(ctx context.Context) error
}

Execute the work of the given agent.

func NewIssueNAgent

func NewIssueNAgent[T THash](sequence TxSequence[T], worker Worker[T], n uint64, metrics *metrics.Metrics) Agent[T]

NewIssueNAgent creates a new issueNAgent

type CreateTx

type CreateTx func(key *ecdsa.PrivateKey, nonce uint64) (*types.Transaction, error)

type THash

type THash interface {
	Hash() common.Hash
}

type TxSequence

type TxSequence[T THash] interface {
	Chan() <-chan T
}

TxSequence provides an interface to return a channel of transactions. The sequence is responsible for closing the channel when there are no further transactions.

func ConvertTxSliceToSequence

func ConvertTxSliceToSequence(txs []*types.Transaction) TxSequence[*types.Transaction]

func GenerateTxSequence

func GenerateTxSequence(ctx context.Context, generator CreateTx, client ethclient.Client, key *ecdsa.PrivateKey, numTxs uint64, async bool) (TxSequence[*types.Transaction], error)

func GenerateTxSequences

func GenerateTxSequences(ctx context.Context, generator CreateTx, client ethclient.Client, keys []*ecdsa.PrivateKey, txsPerKey uint64, async bool) ([]TxSequence[*types.Transaction], error)

type Worker

type Worker[T THash] interface {
	IssueTx(ctx context.Context, tx T) error
	ConfirmTx(ctx context.Context, tx T) error
	LatestHeight(ctx context.Context) (uint64, error)
}

Worker defines the interface for issuance and confirmation of transactions. The caller is responsible for calling Close to cleanup resources used by the worker at the end of the simulation.

Jump to

Keyboard shortcuts

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