MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ProcessBlock

Method ProcessBlock

src/index/base.cpp:174–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174bool BaseIndex::ProcessBlock(const CBlockIndex* pindex, const CBlock* block_data)
175{
176 interfaces::BlockInfo block_info = kernel::MakeBlockInfo(pindex, block_data);
177
178 CBlock block;
179 if (!block_data) { // disk lookup if block data wasn't provided
180 if (!m_chainstate->m_blockman.ReadBlock(block, *pindex)) {
181 FatalErrorf("Failed to read block %s from disk",
182 pindex->GetBlockHash().ToString());
183 return false;
184 }
185 block_info.data = █
186 }
187
188 CBlockUndo block_undo;
189 if (CustomOptions().connect_undo_data) {
190 if (pindex->nHeight > 0 && !m_chainstate->m_blockman.ReadBlockUndo(block_undo, *pindex)) {
191 FatalErrorf("Failed to read undo block data %s from disk",
192 pindex->GetBlockHash().ToString());
193 return false;
194 }
195 block_info.undo_data = &block_undo;
196 }
197
198 if (!CustomAppend(block_info)) {
199 FatalErrorf("Failed to write block %s to index database",
200 pindex->GetBlockHash().ToString());
201 return false;
202 }
203
204 return true;
205}
206
207void BaseIndex::Sync()
208{

Callers 3

mainFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45

Calls 5

MakeBlockInfoFunction · 0.85
ReadBlockUndoMethod · 0.80
ReadBlockMethod · 0.45
ToStringMethod · 0.45
GetBlockHashMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.36