Ejemplo n.º 1
0
        public void Negative_port_just_in_case_for_resilience()
        {
            NetworkNodeDecoder networkNodeDecoder = new NetworkNodeDecoder();
            NetworkNode        node = new NetworkNode(TestItem.PublicKeyA, "127.0.0.1", -1, -100L);
            Rlp         encoded     = networkNodeDecoder.Encode(node);
            NetworkNode decoded     = networkNodeDecoder.Decode(encoded.Bytes.AsRlpStream());

            Assert.AreEqual(node.Host, decoded.Host);
            Assert.AreEqual(node.NodeId, decoded.NodeId);
            Assert.AreEqual(node.Port, decoded.Port);
            Assert.AreEqual(node.Reputation, decoded.Reputation);
        }
Ejemplo n.º 2
0
        public void Can_do_roundtrip_negative_reputation()
        {
            NetworkNodeDecoder networkNodeDecoder = new NetworkNodeDecoder();
            NetworkNode        node = new NetworkNode(TestItem.PublicKeyA, "127.0.0.1", 30303, -100L);
            Rlp         encoded     = networkNodeDecoder.Encode(node);
            NetworkNode decoded     = networkNodeDecoder.Decode(encoded.Bytes.AsRlpStream());

            Assert.AreEqual(node.Host, decoded.Host);
            Assert.AreEqual(node.NodeId, decoded.NodeId);
            Assert.AreEqual(node.Port, decoded.Port);
            Assert.AreEqual(node.Reputation, decoded.Reputation);
        }