Documentation ¶
Index ¶
- func DisableLog()
- func UseLogger(logger elalog.Logger)
- type Listeners
- type Peer
- func (p *Peer) AddKnownInventory(invVect *msg.InvVect)
- func (p *Peer) PushGetBlocksMsg(locator []*common.Uint256, stopHash *common.Uint256) error
- func (p *Peer) PushRejectMsg(command string, code msg.RejectCode, reason string, hash *common.Uint256, ...)
- func (p *Peer) QueueInventory(invVect *msg.InvVect)
- func (p *Peer) RelayTxDisabled() bool
- func (p *Peer) Services() pact.ServiceFlag
- func (p *Peer) SetDisableRelayTx(disable bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.
Types ¶
type Listeners ¶
type Listeners struct { // OnVersion is invoked when a peer receives a version message. OnVersion func(p *Peer, msg *msg.Version) // OnMemPool is invoked when a peer receives a mempool message. OnMemPool func(p *Peer, msg *msg.MemPool) // OnTx is invoked when a peer receives a tx message. OnTx func(p *Peer, msg *msg.Tx) // OnBlock is invoked when a peer receives a block message. OnBlock func(p *Peer, msg *msg.Block) // OnInv is invoked when a peer receives an inv message. OnInv func(p *Peer, msg *msg.Inv) // OnNotFound is invoked when a peer receives a notfound // message. OnNotFound func(p *Peer, msg *msg.NotFound) // OnGetData is invoked when a peer receives a getdata message. OnGetData func(p *Peer, msg *msg.GetData) // OnGetBlocks is invoked when a peer receives a getblocks // message. OnGetBlocks func(p *Peer, msg *msg.GetBlocks) // OnFilterAdd is invoked when a peer receives a filteradd message. OnFilterAdd func(p *Peer, msg *msg.FilterAdd) // OnFilterClear is invoked when a peer receives a filterclear // message. OnFilterClear func(p *Peer, msg *msg.FilterClear) // OnFilterLoad is invoked when a peer receives a filterload // message. OnFilterLoad func(p *Peer, msg *msg.FilterLoad) // OnTxFilterLoad is invoked when a peer receives a txfilter message. OnTxFilterLoad func(p *Peer, msg *msg.TxFilterLoad) // OnReject is invoked when a peer receives a reject message. OnReject func(p *Peer, msg *msg.Reject) // OnDAddr is invoked when a peer receives a daddr message. OnDAddr func(p *Peer, msg *msg.DAddr) }
type Peer ¶
func (*Peer) AddKnownInventory ¶
AddKnownInventory adds the passed inventory to the cache of known inventory for the peer.
This function is safe for concurrent access.
func (*Peer) PushGetBlocksMsg ¶
PushGetBlocksMsg sends a getblocks message for the provided block locator and stop hash. It will ignore back-to-back duplicate requests.
This function is safe for concurrent access.
func (*Peer) PushRejectMsg ¶
func (p *Peer) PushRejectMsg(command string, code msg.RejectCode, reason string, hash *common.Uint256, wait bool)
PushRejectMsg sends a reject message for the provided command, reject code, reject reason, and hash. The hash will only be used when the command is a tx or block and should be nil in other cases. The wait parameter will cause the function to block until the reject message has actually been sent.
This function is safe for concurrent access.
func (*Peer) QueueInventory ¶
QueueInventory adds the passed inventory to the inventory send queue which might not be sent right away, rather it is trickled to the peer in batches. Inventory that the peer is already known to have is ignored.
This function is safe for concurrent access.
func (*Peer) RelayTxDisabled ¶
relayTxDisabled returns whether or not relaying of transactions for the given peer is disabled. It is safe for concurrent access.
func (*Peer) Services ¶
func (p *Peer) Services() pact.ServiceFlag
Services returns the services flag of the remote peer.
This function is safe for concurrent access.
func (*Peer) SetDisableRelayTx ¶
setDisableRelayTx toggles relaying of transactions for the given peer. It is safe for concurrent access.