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; }
public ChainedBlock FindFork(BlockLocator locator) { return(FindFork(locator.Blocks)); }
public ChainedBlock FindFork(BlockLocator locator) { if(locator == null) throw new ArgumentNullException("locator"); return FindFork(locator.Blocks); }
public ChainedBlock FindFork(BlockLocator locator) { return FindFork(locator.Blocks); }