Skip to content

Commit 954ba73

Browse files
committed
Fix priority calculation in CreateTransaction
1 parent dba2a7b commit 954ba73

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ https://github.com/SCDeveloper/All-Work-Done-Prior-to-DarkSilk-RC-Repo/commit/c4
3434
Fix payee selectoin on CMasternodePayments::ProcessBlock
3535
https://github.com/dashpay/dash/commit/428d5976c7630cc4e1f0a0a66d22ae061ce87dfd
3636

37+
fix log output / more notCapableReason-s
38+
https://github.com/dashpay/dash/commit/b861e7ac4ca871626e75953ed833f9195b762932
39+
40+
Fix priority calculation in CreateTransaction
41+
https://github.com/dashpay/dash/commit/9cd1dd9f6b5aace6c0e780bf4365fb2900757c1a
42+
3743

3844

3945
Removal of old code:

src/activemasternode.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ void CActiveMasternode::ManageStatus()
7171
if(GetMasterNodeVin(vin, pubKeyCollateralAddress, keyCollateralAddress)) {
7272

7373
if(GetInputAge(vin) < MASTERNODE_MIN_CONFIRMATIONS){
74-
LogPrintf("CActiveMasternode::ManageStatus() - Input must have least %d confirmations - %d confirmations\n", MASTERNODE_MIN_CONFIRMATIONS, GetInputAge(vin));
74+
notCapableReason = "Input must have least " + boost::lexical_cast<string>(MASTERNODE_MIN_CONFIRMATIONS) +
75+
" confirmations - " + boost::lexical_cast<string>(GetInputAge(vin)) + " confirmations";
76+
LogPrintf("CActiveMasternode::ManageStatus() - %s\n", notCapableReason.c_str());
7577
status = MASTERNODE_INPUT_TOO_NEW;
7678
return;
7779
}
@@ -105,7 +107,7 @@ void CActiveMasternode::ManageStatus()
105107

106108
//send to all peers
107109
if(!Dseep(errorMessage)) {
108-
LogPrintf("CActiveMasternode::ManageStatus() - Error on Ping: %s", errorMessage.c_str());
110+
LogPrintf("CActiveMasternode::ManageStatus() - Error on Ping: %s\n", errorMessage.c_str());
109111
}
110112
}
111113

src/wallet.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2494,6 +2494,14 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64_t> >& vecSend,
24942494
BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins)
24952495
{
24962496
int64_t nCredit = pcoin.first->vout[pcoin.second].nValue;
2497+
//The coin age after the next block (depth+1) is used instead of the current,
2498+
//reflecting an assumption the user would accept a bit more delay for
2499+
//a chance at a free transaction.
2500+
//But mempool inputs might still be in the mempool, so their age stays 0
2501+
int age = pcoin.first->GetDepthInMainChain();
2502+
if (age != 0)
2503+
age += 1;
2504+
dPriority += (double)nCredit * age;
24972505
dPriority += (double)nCredit * pcoin.first->GetDepthInMainChain();
24982506
}
24992507

0 commit comments

Comments
 (0)