aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-02-03 10:35:47 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-02-03 10:36:01 +0100
commit4e2b1fff98a36a07028457e48967d64ed0ce4386 (patch)
tree22b69f6420d553485411f4575d95a8b24317c269 /src
parent41e6e4caba9899ce7c165b0784461c55c867ee24 (diff)
parent2d9b0b7f03a268e557c6dce1dfa29401b5c9178b (diff)
Merge pull request #5675
2d9b0b7 Fix priority calculation in CreateTransaction (Alex Morcos)
Diffstat (limited to 'src')
-rw-r--r--src/wallet.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index d66a4465c5..51cd714197 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -1445,10 +1445,14 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, CAmount> >& vecSend,
BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins)
{
CAmount nCredit = pcoin.first->vout[pcoin.second].nValue;
- //The priority after the next block (depth+1) is used instead of the current,
+ //The coin age after the next block (depth+1) is used instead of the current,
//reflecting an assumption the user would accept a bit more delay for
//a chance at a free transaction.
- dPriority += (double)nCredit * (pcoin.first->GetDepthInMainChain()+1);
+ //But mempool inputs might still be in the mempool, so their age stays 0
+ int age = pcoin.first->GetDepthInMainChain();
+ if (age != 0)
+ age += 1;
+ dPriority += (double)nCredit * age;
}
CAmount nChange = nValueIn - nValue - nFeeRet;