public void Newly_added_can_be_retrieved_as_bonded() { NodeBucket nodeBucket = new NodeBucket(1, 16); nodeBucket.AddNode(_node); nodeBucket.AddNode(_node2); nodeBucket.AddNode(_node3); nodeBucket.BondedItems.Should().HaveCount(3); }
public void Bonded_count_is_tracked() { NodeBucket nodeBucket = new NodeBucket(1, 16); nodeBucket.AddNode(_node); nodeBucket.AddNode(_node2); nodeBucket.AddNode(_node3); nodeBucket.BondedItemsCount.Should().Be(3); }
private static void AddNodes(NodeBucket nodeBucket, int count) { for (int i = 0; i < count; i++) { Node node = new Node( TestItem.PublicKeys[i], IPAddress.Broadcast.ToString(), 30000); nodeBucket.AddNode(node); } }
public NodeAddResult AddNode(Node node) { CheckInitialization(); if (_logger.IsTrace) { _logger.Trace($"Adding node to NodeTable: {node}"); } int distanceFromMaster = _nodeDistanceCalculator.CalculateDistance(MasterNode !.IdHash.Bytes, node.IdHash.Bytes); NodeBucket bucket = Buckets[distanceFromMaster > 0 ? distanceFromMaster - 1 : 0]; return(bucket.AddNode(node)); }