mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 07:39:08 +01:00
Merge pull request #5807
9cd1dd9 Fix priority calculation in CreateTransaction (Alex Morcos)
This commit is contained in:
@@ -1281,10 +1281,14 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64_t> >& vecSend,
|
||||
BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins)
|
||||
{
|
||||
int64_t 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;
|
||||
}
|
||||
|
||||
int64_t nChange = nValueIn - nValue - nFeeRet;
|
||||
|
||||
Reference in New Issue
Block a user