rpc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package rpc provides RPC-based transaction source functionality.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConfigRequired is returned when config is nil
	ErrConfigRequired = errors.New("config is required")
	// ErrRPCEndpointsRequired is returned when rpcEndpoints is empty
	ErrRPCEndpointsRequired = errors.New("rpcEndpoints is required")
)
View Source
var (
	// ErrPollingPanicked is returned when polling handler panics
	ErrPollingPanicked = errors.New("polling handler panicked")
)

Functions

This section is empty.

Types

type Coordinator

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

Coordinator manages multiple RPC peer connections for sourcing transactions

func NewCoordinator

func NewCoordinator(config *source.Config, broadcast func(ctx context.Context, transactions *mimicry.Transactions) error, log logrus.FieldLogger) (*Coordinator, error)

NewCoordinator creates a new RPC source coordinator

func (*Coordinator) Start

func (c *Coordinator) Start(ctx context.Context) error

Start begins the RPC coordinator

func (*Coordinator) Stop

func (c *Coordinator) Stop(_ context.Context) error

Stop stops the RPC coordinator

type CoordinatorStatus

type CoordinatorStatus struct {
	ConnectedPeers    int
	DisconnectedPeers int
}

CoordinatorStatus represents the status of the RPC coordinator

type Peer

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

Peer represents an HTTP RPC connection that polls txpool_content

func NewPeer

func NewPeer(
	_ context.Context,
	log logrus.FieldLogger,
	rpcEndpoint string,
	handler func(ctx context.Context, transactions *mimicry.Transactions) error,
	sharedCache *cache.SharedCache,
	txFilterConfig *source.TransactionFilterConfig,
	metrics *source.Metrics,
	pollInterval time.Duration,
) (*Peer, error)

NewPeer creates a new HTTP polling peer for sourcing transactions

func (*Peer) Start

func (p *Peer) Start(ctx context.Context) (<-chan error, error)

Start begins the HTTP polling peer

func (*Peer) Stop

func (p *Peer) Stop(_ context.Context) error

Stop stops the HTTP polling peer

type PollingPeer

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

PollingPeer represents an HTTP RPC connection that polls txpool_content

func NewPollingPeer

func NewPollingPeer(
	_ context.Context,
	log logrus.FieldLogger,
	rpcEndpoint string,
	handler func(ctx context.Context, transactions *mimicry.Transactions) error,
	sharedCache *cache.SharedCache,
	txFilterConfig *source.TransactionFilterConfig,
	metrics *source.Metrics,
	pollInterval time.Duration,
) (*PollingPeer, error)

NewPollingPeer creates a new HTTP polling peer for sourcing transactions

func (*PollingPeer) Start

func (p *PollingPeer) Start(ctx context.Context) (<-chan error, error)

Start begins the HTTP polling peer

func (*PollingPeer) Stop

func (p *PollingPeer) Stop(_ context.Context) error

Stop stops the HTTP polling peer

type TxPoolContent

type TxPoolContent struct {
	Pending map[string]map[string]*types.Transaction `json:"pending"`
	Queued  map[string]map[string]*types.Transaction `json:"queued"`
}

TxPoolContent represents the response from txpool_content RPC call

Jump to

Keyboard shortcuts

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