Ejemplo n.º 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}");
        }
Ejemplo n.º 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"));
 }
Ejemplo n.º 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"));
 }
Ejemplo n.º 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)));
 }
Ejemplo n.º 5
0
 public ProtocolHandler(ZoroSystem system, LocalNode localNode, Blockchain blockchain)
 {
     this.system     = system;
     this.localNode  = localNode;
     this.blockchain = blockchain;
 }