provider

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NetworkTransactionPool

type NetworkTransactionPool struct {
	M            sync.Mutex
	Transactions map[string]*TransactionState
	Expected     int

	// Last time a transaction was sent
	LastSend time.Time
	// Prevents concurrent transaction send
	ExclusiveSend sync.Mutex
}

NetworkTransactionPool is used locally to share transactions between providers under the same network

type Provider

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

func New

func New(name string, cfg *config.ProviderConfig,
	signerConfig *config.SignerServiceConfig,
	walletConfig *config.WalletConfig,
	txPool *NetworkTransactionPool) *Provider

func (*Provider) Heartbeat

func (p *Provider) Heartbeat(ctx context.Context)

Heartbeat polls for expected in-flight transactions

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) RoundTrip

func (p *Provider) RoundTrip(ctx context.Context)

RoundTrip send a new transaction to measure round trip latency

func (*Provider) Shutdown

func (p *Provider) Shutdown()

func (*Provider) Start

func (p *Provider) Start(ctx context.Context)

func (*Provider) URL

func (p *Provider) URL() string

type TransactionPool

type TransactionPool map[string]*NetworkTransactionPool

TransactionPool is used locally to share transactions between providers under the same pool

type TransactionState

type TransactionState struct {
	// Transaction hash
	Hash common.Hash

	// Mutex
	M sync.Mutex

	SentAt         time.Time
	ProviderSource string

	FirstSeen time.Time

	// Map of providers that have seen this transaction, and when
	// Once all providers have seen the transaction it is removed from the pool
	SeenBy map[string]time.Time
}

Jump to

Keyboard shortcuts

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