MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / WriteBlock

Method WriteBlock

src/index/txindex.cpp:246–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244}
245
246bool TxIndex::WriteBlock(const CBlock& block, const CBlockIndex* pindex)
247{
248 CDiskTxPos pos(pindex->GetBlockPos(), GetSizeOfCompactSize(block.vtx.size()));
249 std::vector<std::pair<uint256, CDiskTxPos>> vPos;
250 vPos.reserve(block.vtx.size());
251 for (const auto& tx : block.vtx) {
252 vPos.emplace_back(tx->GetHash(), pos);
253 pos.nTxOffset += ::GetSerializeSize(*tx, SER_DISK, CLIENT_VERSION);
254 }
255 return m_db->WriteTxs(vPos);
256}
257
258BaseIndex::DB& TxIndex::GetDB() const { return *m_db; }
259

Callers

nothing calls this directly

Calls 7

GetSizeOfCompactSizeFunction · 0.85
GetSerializeSizeFunction · 0.85
GetBlockPosMethod · 0.80
WriteTxsMethod · 0.80
sizeMethod · 0.45
reserveMethod · 0.45
GetHashMethod · 0.45

Tested by

no test coverage detected