MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / finishBlock

Method finishBlock

src/thinblockmanager.cpp:164–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164void ThinBlockManager::finishBlock(const uint256& h, ThinBlockBuilder& builder) {
165 CBlock block;
166 try {
167 block = builder.finishBlock();
168 }
169 catch (thinblock_error& e) {
170 LogPrintf("ERROR: a thinblock builder failed to finish block %s - %s\n",
171 block.ToString(), e.what());
172
173 // Give up on block
174 removeIfExists(h);
175 return;
176 }
177
178 typedef std::set<ThinBlockWorker*>::iterator auto_;
179 std::vector<NodeId> peers;
180 std::set<ThinBlockWorker*> workers = builders[h].workers;
181 for (auto_ w = workers.begin(); w != workers.end(); ++w)
182 peers.push_back((*w)->nodeID());
183
184 ThinBlockFinishedCallb& callb = *finishedCallb;
185 callb(block, peers);
186 removeIfExists(h);
187}
188
189// We ask for announcements with blocks from the
190// last 3 peers to provide a thin block first.

Callers

nothing calls this directly

Calls 5

ToStringMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
nodeIDMethod · 0.45

Tested by

no test coverage detected