Peer class

High-level BitcoinSV peer implementation

Implemented types

Constructors

Peer({required String address, required int port, required BitcoinNetwork network, PeerHandlerI? handler, PeerConfig? config, Logger? logger})

Properties

address String
final
config PeerConfig
final
connected bool
Whether the peer is currently connected
no setteroverride
connectedAt DateTime?
Connection statistics
no setter
handler PeerHandlerI?
final
handshakeComplete bool
Whether handshake is complete
no setter
hashCode int
The hash code for this object.
no setterinherited
isHealthy bool
Whether the peer is considered healthy (responding to pings, etc.)
no setteroverride
isUnhealthyStream Stream<void>
Stream that emits when peer becomes unhealthy
no setteroverride
logger → Logger
final
messagesReceived int
no setter
messagesSent int
no setter
network BitcoinNetwork
The Bitcoin network this peer operates on
no setteroverride
pingsSent int
no setter
pongsReceived int
no setter
port int
final
remoteVersion MsgVersion?
Remote peer version information
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state PeerState
Current peer state
no setter
stateStream Stream<PeerState>
State change events
no setter
unhealthyScore int
no setter

Methods

announceBlock(Hash blockHash) Future<void>
Announce a block hash to this peer
override
announceTransaction(Hash txHash) Future<void>
Announce a transaction hash to this peer
override
connect() Future<void>
Connect to the peer and perform Bitcoin protocol handshake
getStatistics() Map<String, dynamic>
Get peer statistics
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requestBlock(Hash blockHash) Future<void>
Request a block from this peer
override
requestTransaction(Hash txHash) Future<void>
Request a transaction from this peer
override
restart() Future<void>
Restart the peer connection
override
shutdown() Future<void>
Shutdown the peer connection
override
toString() String
A string representation of this object.
override
writeMessage(WireMessage msg) Future<void>
Send a wire protocol message to the peer
override

Operators

operator ==(Object other) bool
The equality operator.
inherited