Example #1
0
        public async Task RemovesPeerFromRoutingTable()
        {
            var swarm = new Swarm {
                LocalPeer = self
            };
            var dht = new Dht1 {
                Swarm = swarm
            };
            await dht.StartAsync();

            try
            {
                var peer = swarm.RegisterPeerAddress("/ip4/127.0.0.1/tcp/4001/ipfs/QmdpwjdB94eNm2Lcvp9JqoCxswo3AKQqjLuNZyLixmCM1h");
                Assert.IsTrue(dht.RoutingTable.Contains(peer));

                swarm.DeregisterPeer(peer);
                Assert.IsFalse(dht.RoutingTable.Contains(peer));
            }
            finally
            {
                await dht.StopAsync();
            }
        }