diff options
author | Jim Posen <jim.posen@gmail.com> | 2018-08-27 12:28:35 -0700 |
---|---|---|
committer | Jim Posen <jim.posen@gmail.com> | 2018-08-27 17:03:24 -0700 |
commit | ed12d5df1ba52b5ef3dd3799de26bb5e1d3fc654 (patch) | |
tree | 947882744b34f59d1668b3d4636641c4b9daaed3 /src/index | |
parent | 0df9b0aed23127acd12d9ed6a008c12be47b1cd9 (diff) |
index: Fix for indexers skipping genesis block.
Diffstat (limited to 'src/index')
-rw-r--r-- | src/index/base.cpp | 6 | ||||
-rw-r--r-- | src/index/txindex.cpp | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/index/base.cpp b/src/index/base.cpp index 788f7adccd..3cf2a89a2d 100644 --- a/src/index/base.cpp +++ b/src/index/base.cpp @@ -60,7 +60,11 @@ bool BaseIndex::Init() } LOCK(cs_main); - m_best_block_index = FindForkInGlobalIndex(chainActive, locator); + if (locator.IsNull()) { + m_best_block_index = nullptr; + } else { + m_best_block_index = FindForkInGlobalIndex(chainActive, locator); + } m_synced = m_best_block_index.load() == chainActive.Tip(); return true; } diff --git a/src/index/txindex.cpp b/src/index/txindex.cpp index c85030e18e..224004ce1c 100644 --- a/src/index/txindex.cpp +++ b/src/index/txindex.cpp @@ -245,6 +245,9 @@ bool TxIndex::Init() bool TxIndex::WriteBlock(const CBlock& block, const CBlockIndex* pindex) { + // Exclude genesis block transaction because outputs are not spendable. + if (pindex->nHeight == 0) return true; + CDiskTxPos pos(pindex->GetBlockPos(), GetSizeOfCompactSize(block.vtx.size())); std::vector<std::pair<uint256, CDiskTxPos>> vPos; vPos.reserve(block.vtx.size()); |