p2p

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInMemObscuroClient

func NewInMemObscuroClient(hostContainer *container.HostContainer) rpc.Client

Types

type MockP2P

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

MockP2P - models the p2p service of a host, but instead of sending messages over tcp it uses the `MockP2PNetwork` to distribute messages

func NewMockP2P

func NewMockP2P(network *MockP2PNetwork, id string, isIncomingP2PDisabled bool) *MockP2P

NewMockP2P returns an instance of a configured L2 Network (no nodes)

func (*MockP2P) BroadcastBatches

func (n *MockP2P) BroadcastBatches(batches []*common.ExtBatch) error

func (*MockP2P) HealthStatus

func (n *MockP2P) HealthStatus() host.HealthStatus

func (*MockP2P) ReceiveBatchRequest

func (n *MockP2P) ReceiveBatchRequest(requestID string, fromSeqNo *big.Int)

ReceiveBatchRequest is a mock method that simulates receiving a batch request from a peer and then forwarding to all subscribers

func (*MockP2P) ReceiveBatches

func (n *MockP2P) ReceiveBatches(batches []*common.ExtBatch, isLive bool)

ReceiveBatches is a mock method that simulates receiving a batch from a peer and then forwarding to all subscribers

func (*MockP2P) ReceiveTransaction

func (n *MockP2P) ReceiveTransaction(tx common.EncryptedTx)

ReceiveTransaction is a mock method that simulates receiving a batch from a peer and then forwarding to all subscribers

func (*MockP2P) RefreshPeerList

func (n *MockP2P) RefreshPeerList()

func (*MockP2P) RequestBatchesFromSequencer

func (n *MockP2P) RequestBatchesFromSequencer(fromSeqNo *big.Int) error

func (*MockP2P) RespondToBatchRequest

func (n *MockP2P) RespondToBatchRequest(requesterID string, batches []*common.ExtBatch) error

func (*MockP2P) SendTxToSequencer

func (n *MockP2P) SendTxToSequencer(tx common.EncryptedTx) error

func (*MockP2P) Start

func (n *MockP2P) Start() error

func (*MockP2P) Stop

func (n *MockP2P) Stop() error

func (*MockP2P) SubscribeForBatchRequests

func (n *MockP2P) SubscribeForBatchRequests(handler host.P2PBatchRequestHandler) func()

func (*MockP2P) SubscribeForBatches

func (n *MockP2P) SubscribeForBatches(handler host.P2PBatchHandler) func()

func (*MockP2P) SubscribeForTx

func (n *MockP2P) SubscribeForTx(handler host.P2PTxHandler) func()

func (*MockP2P) UpdatePeerList

func (n *MockP2P) UpdatePeerList([]string)

type MockP2PNetwork

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

func (*MockP2PNetwork) BroadcastBatch

func (m *MockP2PNetwork) BroadcastBatch(fromNodeID string, batches []*common.ExtBatch)

func (*MockP2PNetwork) NewNode

func (m *MockP2PNetwork) NewNode(id int) host.P2PHostService

func (*MockP2PNetwork) RequestBatchesFromSequencer

func (m *MockP2PNetwork) RequestBatchesFromSequencer(id string, fromSeqNo *big.Int)

func (*MockP2PNetwork) RespondToBatchRequest

func (m *MockP2PNetwork) RespondToBatchRequest(requesterID string, batches []*common.ExtBatch)

func (*MockP2PNetwork) SendTransactionToSequencer

func (m *MockP2PNetwork) SendTransactionToSequencer(tx common.EncryptedTx)

type MockP2PNetworkIntf

type MockP2PNetworkIntf interface {
	NewNode(id int) host.P2PHostService
}

func NewMockP2PNetwork

func NewMockP2PNetwork(avgBlockDuration time.Duration, avgLatency time.Duration, nodeWithIncomingP2PDisabled int) MockP2PNetworkIntf

Jump to

Keyboard shortcuts

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