batcher

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SKIP = iota
	ACCEPT
	REMOVE
	FULL
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Batcher

type Batcher struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewStatefulBatcher

func NewStatefulBatcher(
	ctx context.Context,
	db *txdb.TxDB,
	chainId *big.Int,
	receiptFetcher ethutils.ReceiptFetcher,
	globalInbox l2TxSender,
	maxBatchTime time.Duration,
) (*Batcher, error)

func NewStatelessBatcher

func NewStatelessBatcher(
	ctx context.Context,
	db *txdb.TxDB,
	chainId *big.Int,
	receiptFetcher ethutils.ReceiptFetcher,
	globalInbox l2TxSender,
	maxBatchTime time.Duration,
) *Batcher

func (*Batcher) PendingSnapshot

func (m *Batcher) PendingSnapshot() (*snapshot.Snapshot, error)

func (*Batcher) PendingTransactionCount

func (m *Batcher) PendingTransactionCount(_ context.Context, account common.Address) *uint64

func (*Batcher) SendTransaction

func (m *Batcher) SendTransaction(_ context.Context, tx *types.Transaction) error

SendTransaction takes a request signed transaction l2message from a client and puts it in a queue to be included in the next transaction batch

func (*Batcher) SubscribeNewTxsEvent

func (m *Batcher) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription

type Forwarder

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

func NewForwarder

func NewForwarder(client *ethclient.Client) *Forwarder

func (*Forwarder) PendingSnapshot

func (b *Forwarder) PendingSnapshot() (*snapshot.Snapshot, error)

func (*Forwarder) PendingTransactionCount

func (b *Forwarder) PendingTransactionCount(ctx context.Context, account common.Address) *uint64

Return nil if no pending transaction count is available

func (*Forwarder) SendTransaction

func (b *Forwarder) SendTransaction(ctx context.Context, tx *types.Transaction) error

func (*Forwarder) SubscribeNewTxsEvent

func (b *Forwarder) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription

type TransactionBatcher

type TransactionBatcher interface {
	// Return nil if no pending transaction count is available
	PendingTransactionCount(ctx context.Context, account common.Address) *uint64

	SendTransaction(ctx context.Context, tx *types.Transaction) error

	SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription

	// Return nil if no pending snapshot is available
	PendingSnapshot() (*snapshot.Snapshot, error)
}

type TxHeap

type TxHeap []*types.Transaction

An TxHeap is a min-heap of transactions sorted by nonce.

func (TxHeap) Len

func (h TxHeap) Len() int

func (TxHeap) Less

func (h TxHeap) Less(i, j int) bool

func (*TxHeap) Pop

func (h *TxHeap) Pop() interface{}

func (*TxHeap) Push

func (h *TxHeap) Push(x interface{})

func (TxHeap) Swap

func (h TxHeap) Swap(i, j int)

Jump to

Keyboard shortcuts

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