Changeset View
Changeset View
Standalone View
Standalone View
src/index/txindex.cpp
Show First 20 Lines • Show All 251 Lines • ▼ Show 20 Lines | bool TxIndex::WriteBlock(const CBlock &block, const CBlockIndex *pindex) { | ||||
} | } | ||||
CDiskTxPos pos(pindex->GetBlockPos(), | CDiskTxPos pos(pindex->GetBlockPos(), | ||||
GetSizeOfCompactSize(block.vtx.size())); | GetSizeOfCompactSize(block.vtx.size())); | ||||
std::vector<std::pair<TxId, CDiskTxPos>> vPos; | std::vector<std::pair<TxId, CDiskTxPos>> vPos; | ||||
vPos.reserve(block.vtx.size()); | vPos.reserve(block.vtx.size()); | ||||
for (const auto &tx : block.vtx) { | for (const auto &tx : block.vtx) { | ||||
vPos.emplace_back(tx->GetId(), pos); | vPos.emplace_back(tx->GetId(), pos); | ||||
pos.nTxOffset += ::GetSerializeSize(*tx, SER_DISK, CLIENT_VERSION); | pos.nTxOffset += ::GetSerializeSize(*tx, CLIENT_VERSION); | ||||
} | } | ||||
return m_db->WriteTxs(vPos); | return m_db->WriteTxs(vPos); | ||||
} | } | ||||
BaseIndex::DB &TxIndex::GetDB() const { | BaseIndex::DB &TxIndex::GetDB() const { | ||||
return *m_db; | return *m_db; | ||||
} | } | ||||
Show All 27 Lines |