MCPcopy Create free account
hub / github.com/ElementsProject/elements / UpdatePackagesForAdded

Method UpdatePackagesForAdded

src/node/miner.cpp:304–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304int BlockAssembler::UpdatePackagesForAdded(const CTxMemPool::setEntries& alreadyAdded,
305 indexed_modified_transaction_set &mapModifiedTx)
306{
307 AssertLockHeld(m_mempool.cs);
308
309 int nDescendantsUpdated = 0;
310 for (CTxMemPool::txiter it : alreadyAdded) {
311 CTxMemPool::setEntries descendants;
312 m_mempool.CalculateDescendants(it, descendants);
313 // Insert all descendants (not yet in block) into the modified set
314 for (CTxMemPool::txiter desc : descendants) {
315 if (alreadyAdded.count(desc)) {
316 continue;
317 }
318 ++nDescendantsUpdated;
319 modtxiter mit = mapModifiedTx.find(desc);
320 if (mit == mapModifiedTx.end()) {
321 CTxMemPoolModifiedEntry modEntry(desc);
322 modEntry.nSizeWithAncestors -= it->GetTxSize();
323 modEntry.discountSizeWithAncestors -= it->GetDiscountTxSize();
324 modEntry.nModFeesWithAncestors -= it->GetModifiedFee();
325 modEntry.nSigOpCostWithAncestors -= it->GetSigOpCost();
326 mapModifiedTx.insert(modEntry);
327 } else {
328 mapModifiedTx.modify(mit, update_for_parent_inclusion(it));
329 }
330 }
331 }
332 return nDescendantsUpdated;
333}
334
335// Skip entries in mapTx that are already in a block or are present
336// in mapModifiedTx (which implies that the mapTx ancestor state is

Callers

nothing calls this directly

Calls 10

CalculateDescendantsMethod · 0.80
countMethod · 0.80
findMethod · 0.80
GetSigOpCostMethod · 0.80
endMethod · 0.45
GetTxSizeMethod · 0.45
GetDiscountTxSizeMethod · 0.45
GetModifiedFeeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected