Пример #1
0
		public BlockLocator GetLocator()
		{
			int nStep = 1;
			List<uint256> vHave = new List<uint256>();

			var pindex = this;
			while(pindex != null)
			{
				vHave.Add(pindex.HashBlock);
				// Stop when we have added the genesis block.
				if(pindex.Height == 0)
					break;
				// Exponentially larger steps back, plus the genesis block.
				int nHeight = Math.Max(pindex.Height - nStep, 0);
				while(pindex.Height > nHeight)
					pindex = pindex.Previous;
				if(vHave.Count > 10)
					nStep *= 2;
			}

			var locators = new BlockLocator();
			locators.Blocks = vHave;
			return locators;
		}
Пример #2
0
 public ChainedBlock FindFork(BlockLocator locator)
 {
     return(FindFork(locator.Blocks));
 }
Пример #3
0
		public ChainedBlock FindFork(BlockLocator locator)
		{
			if(locator == null)
				throw new ArgumentNullException("locator");
			return FindFork(locator.Blocks);
		}
Пример #4
0
 public ChainedBlock FindFork(BlockLocator locator)
 {
     return FindFork(locator.Blocks);
 }