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

Method PrioritiseTransaction

src/txmempool.cpp:1022–1050  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1020}
1021
1022void CTxMemPool::PrioritiseTransaction(const uint256& hash, const CAmount& nFeeDelta)
1023{
1024 {
1025 LOCK(cs);
1026 CAmount &delta = mapDeltas[hash];
1027 delta = SaturatingAdd(delta, nFeeDelta);
1028 txiter it = mapTx.find(hash);
1029 if (it != mapTx.end()) {
1030 mapTx.modify(it, [&nFeeDelta](CTxMemPoolEntry& e) { e.UpdateModifiedFee(nFeeDelta); });
1031 // Now update all ancestors' modified fees with descendants
1032 setEntries setAncestors;
1033 uint64_t nNoLimit = std::numeric_limits<uint64_t>::max();
1034 std::string dummy;
1035 CalculateMemPoolAncestors(*it, setAncestors, nNoLimit, nNoLimit, nNoLimit, nNoLimit, dummy, false);
1036 for (txiter ancestorIt : setAncestors) {
1037 mapTx.modify(ancestorIt, update_descendant_state(0, nFeeDelta, 0));
1038 }
1039 // Now update all descendants' modified fees with ancestors
1040 setEntries setDescendants;
1041 CalculateDescendants(it, setDescendants);
1042 setDescendants.erase(it);
1043 for (txiter descendantIt : setDescendants) {
1044 mapTx.modify(descendantIt, update_ancestor_state(0, nFeeDelta, 0, 0, 0));
1045 }
1046 ++nTransactionsUpdated;
1047 }
1048 }
1049 LogPrintf("PrioritiseTransaction: %s fee += %s\n", hash.ToString(), FormatMoney(nFeeDelta));
1050}
1051
1052void CTxMemPool::ApplyDelta(const uint256& hash, CAmount &nFeeDelta) const
1053{

Callers 3

LoadMempoolFunction · 0.80
FUZZ_TARGET_INITFunction · 0.80
prioritisetransactionFunction · 0.80

Calls 9

SaturatingAddFunction · 0.85
FormatMoneyFunction · 0.85
findMethod · 0.80
UpdateModifiedFeeMethod · 0.80
endMethod · 0.45
eraseMethod · 0.45
ToStringMethod · 0.45

Tested by 1

FUZZ_TARGET_INITFunction · 0.64