aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.cpp
diff options
context:
space:
mode:
authorAlex Morcos <morcos@chaincode.com>2017-01-19 23:37:15 -0500
committerAlex Morcos <morcos@chaincode.com>2017-03-03 16:50:19 -0500
commitf9b9371c6027905f73a2558d6bcaca8a355c28a6 (patch)
treeb4570c3ec262217988e310f42035a011c0f23b1e /src/txmempool.cpp
parent49be7e1bef23afec617ed211a804f375f1620a22 (diff)
[rpc] Remove priorityDelta from prioritisetransaction
This a breaking API change to the prioritisetransaction RPC call which previously required exactly three arguments and now requires exactly two (hash and feeDelta). The function prioritiseTransaction is also updated.
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r--src/txmempool.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index ef4d4f3c62..58a71ad95e 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -404,11 +404,11 @@ bool CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry,
// Update transaction for any feeDelta created by PrioritiseTransaction
// TODO: refactor so that the fee delta is calculated before inserting
// into mapTx.
- std::map<uint256, std::pair<double, CAmount> >::const_iterator pos = mapDeltas.find(hash);
+ std::map<uint256, CAmount>::const_iterator pos = mapDeltas.find(hash);
if (pos != mapDeltas.end()) {
- const std::pair<double, CAmount> &deltas = pos->second;
- if (deltas.second) {
- mapTx.modify(newit, update_fee_delta(deltas.second));
+ const CAmount &delta = pos->second;
+ if (delta) {
+ mapTx.modify(newit, update_fee_delta(delta));
}
}
@@ -910,16 +910,15 @@ CTxMemPool::ReadFeeEstimates(CAutoFile& filein)
return true;
}
-void CTxMemPool::PrioritiseTransaction(const uint256& hash, double dPriorityDelta, const CAmount& nFeeDelta)
+void CTxMemPool::PrioritiseTransaction(const uint256& hash, const CAmount& nFeeDelta)
{
{
LOCK(cs);
- std::pair<double, CAmount> &deltas = mapDeltas[hash];
- deltas.first += dPriorityDelta;
- deltas.second += nFeeDelta;
+ CAmount &delta = mapDeltas[hash];
+ delta += nFeeDelta;
txiter it = mapTx.find(hash);
if (it != mapTx.end()) {
- mapTx.modify(it, update_fee_delta(deltas.second));
+ mapTx.modify(it, update_fee_delta(delta));
// Now update all ancestors' modified fees with descendants
setEntries setAncestors;
uint64_t nNoLimit = std::numeric_limits<uint64_t>::max();
@@ -930,18 +929,17 @@ void CTxMemPool::PrioritiseTransaction(const uint256& hash, double dPriorityDelt
}
}
}
- LogPrintf("PrioritiseTransaction: %s priority += %f, fee += %d\n", hash.ToString(), dPriorityDelta, FormatMoney(nFeeDelta));
+ LogPrintf("PrioritiseTransaction: %s feerate += %s\n", hash.ToString(), FormatMoney(nFeeDelta));
}
-void CTxMemPool::ApplyDeltas(const uint256 hash, double &dPriorityDelta, CAmount &nFeeDelta) const
+void CTxMemPool::ApplyDelta(const uint256 hash, CAmount &nFeeDelta) const
{
LOCK(cs);
- std::map<uint256, std::pair<double, CAmount> >::const_iterator pos = mapDeltas.find(hash);
+ std::map<uint256, CAmount>::const_iterator pos = mapDeltas.find(hash);
if (pos == mapDeltas.end())
return;
- const std::pair<double, CAmount> &deltas = pos->second;
- dPriorityDelta += deltas.first;
- nFeeDelta += deltas.second;
+ const CAmount &delta = pos->second;
+ nFeeDelta += delta;
}
void CTxMemPool::ClearPrioritisation(const uint256 hash)