Example #1
0
        public RemoteNode(ZoroSystem system, object connection, IPEndPoint remote, IPEndPoint local, Blockchain blockchain, LocalNode localNode)
            : base(connection, remote, local)
        {
            this.system     = system;
            this.localNode  = localNode;
            this.blockchain = blockchain;

            this.protocol = Context.ActorOf(ProtocolHandler.Props(system, localNode, blockchain, this), "RemoteNode");
            localNode.RemoteNodes.TryAdd(Self, this);

            SendMessage(Message.Create(MessageType.Version, VersionPayload.Create(localNode.ChainHash, localNode.ListenerPort, LocalNode.NodeId, LocalNode.UserAgent, blockchain.Height)));

            Log($"Connected to RemoteNode {blockchain.Name} {remote}");
        }
Example #2
0
 internal static Props Props(ZoroSystem system, object connection, IPEndPoint remote, IPEndPoint local, Blockchain blockchain, LocalNode localNode)
 {
     return(Akka.Actor.Props.Create(() => new RemoteNode(system, connection, remote, local, blockchain, localNode)).WithMailbox("remote-node-mailbox"));
 }
Example #3
0
 public static Props Props(ZoroSystem system, LocalNode localNode, Blockchain blockchain, RemoteNode remoteNode)
 {
     return(Akka.Actor.Props.Create(() => new ProtocolHandler(system, localNode, blockchain, remoteNode)).WithMailbox("protocol-handler-mailbox"));
 }
Example #4
0
 public RemoteNode(ZoroSystem system, object connection, IPEndPoint remote, IPEndPoint local, LocalNode localNode)
     : base(connection, remote, local)
 {
     this.system    = system;
     this.localNode = localNode;
     this.protocol  = Context.ActorOf(ProtocolHandler.Props(system, localNode, localNode.Blockchain));
     localNode.RemoteNodes.TryAdd(Self, this);
     SendMessage(Message.Create("version", VersionPayload.Create(localNode.ListenerPort, LocalNode.Nonce, LocalNode.UserAgent, localNode.Blockchain.Height)));
 }
Example #5
0
 public ProtocolHandler(ZoroSystem system, LocalNode localNode, Blockchain blockchain)
 {
     this.system     = system;
     this.localNode  = localNode;
     this.blockchain = blockchain;
 }