protocol

package
v1.0.0-Testnet-1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: ISC Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager manages the p2p protocol

func NewManager

func NewManager(cfg *config.Config, domain domain.Domain, netAdapter *netadapter.NetAdapter, addressManager *addressmanager.AddressManager,
	connectionManager *connmanager.ConnectionManager) (*Manager, error)

NewManager creates a new instance of the p2p protocol manager

func (*Manager) AddBlock

func (m *Manager) AddBlock(block *externalapi.DomainBlock) error

AddBlock adds the given block to the DAG and propagates it.

func (*Manager) AddTransaction

func (m *Manager) AddTransaction(tx *externalapi.DomainTransaction, allowOrphan bool) error

AddTransaction adds transaction to the mempool and propagates it.

func (*Manager) Close

func (m *Manager) Close()

Close closes the protocol manager and waits until all p2p flows finish.

func (*Manager) Context

func (m *Manager) Context() *flowcontext.FlowContext

Context returns the manager's flow context

func (*Manager) IBDPeer

func (m *Manager) IBDPeer() *peerpkg.Peer

IBDPeer returns the current IBD peer or null if the node is not in IBD

func (*Manager) IsIBDRunning

func (m *Manager) IsIBDRunning() bool

IsIBDRunning returns true if IBD is currently marked as running

func (*Manager) Peers

func (m *Manager) Peers() []*peerpkg.Peer

Peers returns the currently active peers

func (*Manager) RegisterFlow

func (m *Manager) RegisterFlow(name string, router *routerpkg.Router, messageTypes []appmessage.MessageCommand, isStopping *uint32,
	errChan chan error, initializeFunc common.FlowInitializeFunc) *common.Flow

RegisterFlow registers a flow to the given router.

func (*Manager) RegisterFlowWithCapacity

func (m *Manager) RegisterFlowWithCapacity(name string, capacity int, router *routerpkg.Router,
	messageTypes []appmessage.MessageCommand, isStopping *uint32,
	errChan chan error, initializeFunc common.FlowInitializeFunc) *common.Flow

RegisterFlowWithCapacity registers a flow to the given router with a custom capacity.

func (*Manager) RegisterOneTimeFlow

func (m *Manager) RegisterOneTimeFlow(name string, router *routerpkg.Router, messageTypes []appmessage.MessageCommand,
	isStopping *uint32, stopChan chan error, initializeFunc common.FlowInitializeFunc) *common.Flow

RegisterOneTimeFlow registers a one-time flow (that exits once some operations are done) to the given router.

func (*Manager) SetOnNewBlockTemplateHandler

func (m *Manager) SetOnNewBlockTemplateHandler(onNewBlockTemplateHandler flowcontext.OnNewBlockTemplateHandler)

SetOnNewBlockTemplateHandler sets the onNewBlockTemplate handler

func (*Manager) SetOnPruningPointUTXOSetOverrideHandler

func (m *Manager) SetOnPruningPointUTXOSetOverrideHandler(onPruningPointUTXOSetOverrideHandler flowcontext.OnPruningPointUTXOSetOverrideHandler)

SetOnPruningPointUTXOSetOverrideHandler sets the OnPruningPointUTXOSetOverride handler

func (*Manager) SetOnTransactionAddedToMempoolHandler

func (m *Manager) SetOnTransactionAddedToMempoolHandler(onTransactionAddedToMempoolHandler flowcontext.OnTransactionAddedToMempoolHandler)

SetOnTransactionAddedToMempoolHandler sets the onTransactionAddedToMempool handler

Jump to

Keyboard shortcuts

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