aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2012-07-11 18:52:41 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2014-06-26 11:49:46 +0000
commit2a72d4591f5adf25fcb4d0433b390ba6c37f57a9 (patch)
treeb46f8cc4f0529ca6d1faebdb5690ba3353044fc1 /src/txmempool.cpp
parent343feecf562a39e7d898ece2fd745fcb9d4c90e9 (diff)
JSON-RPC method: prioritisetransaction <txid> <priority delta> <priority tx fee>
Accepts the transaction into mined blocks at a higher (or lower) priority
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r--src/txmempool.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index 4bf01d4848..52f82ef040 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -447,6 +447,7 @@ void CTxMemPool::removeForBlock(const std::vector<CTransaction>& vtx, unsigned i
std::list<CTransaction> dummy;
remove(tx, dummy, false);
removeConflicts(tx, conflicts);
+ ClearPrioritisation(tx.GetHash());
}
}
@@ -564,6 +565,34 @@ CTxMemPool::ReadFeeEstimates(CAutoFile& filein)
return true;
}
+void CTxMemPool::PrioritiseTransaction(const uint256 hash, const string strHash, double dPriorityDelta, int64_t nFeeDelta)
+{
+ {
+ LOCK(cs);
+ std::pair<double, int64_t> &deltas = mapDeltas[hash];
+ deltas.first += dPriorityDelta;
+ deltas.second += nFeeDelta;
+ }
+ LogPrintf("PrioritiseTransaction: %s priority += %f, fee += %d\n", strHash.c_str(), dPriorityDelta, nFeeDelta);
+}
+
+void CTxMemPool::ApplyDeltas(const uint256 hash, double &dPriorityDelta, int64_t &nFeeDelta)
+{
+ LOCK(cs);
+ std::map<uint256, std::pair<double, int64_t> >::iterator pos = mapDeltas.find(hash);
+ if (pos == mapDeltas.end())
+ return;
+ const std::pair<double, int64_t> &deltas = pos->second;
+ dPriorityDelta += deltas.first;
+ nFeeDelta += deltas.second;
+}
+
+void CTxMemPool::ClearPrioritisation(const uint256 hash)
+{
+ LOCK(cs);
+ mapDeltas.erase(hash);
+}
+
CCoinsViewMemPool::CCoinsViewMemPool(CCoinsView &baseIn, CTxMemPool &mempoolIn) : CCoinsViewBacked(baseIn), mempool(mempoolIn) { }