| 1020 | } |
| 1021 | |
| 1022 | void 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 | |
| 1052 | void CTxMemPool::ApplyDelta(const uint256& hash, CAmount &nFeeDelta) const |
| 1053 | { |