| 55 | TxIndex::~TxIndex() {} |
| 56 | |
| 57 | bool TxIndex::WriteBlock(const CBlock& block, const CBlockIndex* pindex) |
| 58 | { |
| 59 | // Exclude genesis block transaction because outputs are not spendable. |
| 60 | //ELEMENTS: we do index the genesis block |
| 61 | //if (pindex->nHeight == 0) return true; |
| 62 | |
| 63 | CDiskTxPos pos{ |
| 64 | WITH_LOCK(::cs_main, return pindex->GetBlockPos()), |
| 65 | GetSizeOfCompactSize(block.vtx.size())}; |
| 66 | std::vector<std::pair<uint256, CDiskTxPos>> vPos; |
| 67 | vPos.reserve(block.vtx.size()); |
| 68 | for (const auto& tx : block.vtx) { |
| 69 | vPos.emplace_back(tx->GetHash(), pos); |
| 70 | pos.nTxOffset += ::GetSerializeSize(*tx, CLIENT_VERSION); |
| 71 | } |
| 72 | return m_db->WriteTxs(vPos); |
| 73 | } |
| 74 | |
| 75 | BaseIndex::DB& TxIndex::GetDB() const { return *m_db; } |
| 76 |
nothing calls this directly
no test coverage detected