public BlockLocator GetCurrentChainLocator() { List<StoredBlock> headers = new List<StoredBlock>(); using (BlockchainRepository repo = new BlockchainRepository(conn)) { StoredBlock lastBlock = repo.GetLastBlockHeader(); if (lastBlock != null) { headers = repo.ReadHeadersWithHeight(BlockLocator.GetRequiredBlockHeights(lastBlock.Height)); } } BlockLocator locator = new BlockLocator(); foreach (StoredBlock header in headers) { locator.AddHash(header.Height, header.Hash); } return locator; }