Exemplo n.º 1
0
			internal int GetNewBucket(uint256 nKey, IPAddress src)
			{
				byte[] vchSourceGroupKey = src.GetGroup();
				UInt64 hash1 = Cheap(Hashes.Hash256(
					nKey.ToBytes(true)
					.Concat(Address.Endpoint.Address.GetGroup())
					.Concat(vchSourceGroupKey)
					.ToArray()));

				UInt64 hash2 = Cheap(Hashes.Hash256(
					nKey.ToBytes(true)
					.Concat(vchSourceGroupKey)
					.Concat(Utils.ToBytes(hash1 % AddressManager.ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP, true))
					.ToArray()));
				return (int)(hash2 % ADDRMAN_NEW_BUCKET_COUNT);
			}