package networking
- Alphabetic
- Public
- Protected
Type Members
- case class P2PClient(actor: ActorRef, peer: Peer) extends P2PLogger with Product with Serializable
- case class P2PClientActor(peer: Peer, initPeerMsgHandlerReceiver: PeerMessageReceiver, onReconnect: () => Future[Unit])(implicit config: NodeAppConfig) extends Actor with P2PLogger with Product with Serializable
This actor is responsible for creating a connection, relaying messages and closing a connection to our peer on the P2P network.
This actor is responsible for creating a connection, relaying messages and closing a connection to our peer on the P2P network. This is the actor that directly interacts with the p2p network. It's responsibly is to deal with low level .TCP messages.
If the client receives a NetworkMessage, from a PeerMessageSender it serializes the message to it to a akka.util.ByteString and then sends it to the internal
manager
which streams the data to our peer on the Bitcoin network.If the client receives a Tcp.Received message, it means we have received a message from our peer on the Bitcoin P2P network. This means we try to parse the bytes into a NetworkMessage. If we successfully parse the message we relay that message to the PeerMessageSender that created the Client Actor.
In this class you will see a 'unalignedBytes' value passed around in a lot of methods. This is because we cannot assume that a Bitcoin P2P message aligns with a TCP packet. For instance, a large block message (up to 4MB in size) CANNOT fit in a single TCP packet. This means we must cache the bytes and wait for the rest of them to be sent.
- initPeerMsgHandlerReceiver
The place we send messages that we successfully parsed from our peer on the P2P network. This is mostly likely a org.bitcoins.node.networking.peer.PeerMessageSender
Value Members
- object P2PClient extends P2PLogger with Serializable