mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-02 11:55:42 +02:00
Merge #9602: Remove coin age priority and free transactions - implementation
b421e6dUpdate example bitcoin.conf (Alex Morcos)7d4e950Allow setting minrelaytxfee to 0 (Alex Morcos)359e8a0[cleanup] Remove coin age priority completely. (Alex Morcos)f9b9371[rpc] Remove priorityDelta from prioritisetransaction (Alex Morcos)49be7e1[rpc] Remove priority information from mempool RPC calls (Alex Morcos)0315888[test] Remove priority from tests (Alex Morcos)f838005No longer allow "free" transactions (Alex Morcos)ad727f4[rpc] sendrawtransaction no longer bypasses minRelayTxFee (Alex Morcos)fe282ac[cleanup] Remove estimatePriority and estimateSmartPriority (Alex Morcos)400b151[debug] Change -printpriority option (Alex Morcos)272b25a[mining] Remove -blockprioritysize. (Alex Morcos)12839cd[rpc] Remove estimatepriority and estimatesmartpriority. (Alex Morcos)ddf58c7wallet: Remove sendfree (MarcoFalke) Tree-SHA512: a9a4499405923ce794ef18f9e334dbbd59dfc73a3dc2df6f85cc9c62af6f353ec2eed9c2d5e58e904f918d0d7ab738f403dd4939d9bc2276136864fe63710782
This commit is contained in:
@@ -40,7 +40,6 @@ CWallet* pwalletMain = NULL;
|
||||
CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE);
|
||||
unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET;
|
||||
bool bSpendZeroConfChange = DEFAULT_SPEND_ZEROCONF_CHANGE;
|
||||
bool fSendFreeTransactions = DEFAULT_SEND_FREE_TRANSACTIONS;
|
||||
bool fWalletRbf = DEFAULT_WALLET_RBF;
|
||||
|
||||
const char * DEFAULT_WALLET_DAT = "wallet.dat";
|
||||
@@ -2379,7 +2378,6 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||
CAmount nValueToSelect = nValue;
|
||||
if (nSubtractFeeFromAmount == 0)
|
||||
nValueToSelect += nFeeRet;
|
||||
double dPriority = 0;
|
||||
// vouts to the payees
|
||||
for (const auto& recipient : vecSend)
|
||||
{
|
||||
@@ -2420,19 +2418,6 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||
strFailReason = _("Insufficient funds");
|
||||
return false;
|
||||
}
|
||||
for (const auto& pcoin : setCoins)
|
||||
{
|
||||
CAmount nCredit = pcoin.first->tx->vout[pcoin.second].nValue;
|
||||
//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.
|
||||
//But mempool inputs might still be in the mempool, so their age stays 0
|
||||
int age = pcoin.first->GetDepthInMainChain();
|
||||
assert(age >= 0);
|
||||
if (age != 0)
|
||||
age += 1;
|
||||
dPriority += (double)nCredit * age;
|
||||
}
|
||||
|
||||
const CAmount nChange = nValueIn - nValueToSelect;
|
||||
if (nChange > 0)
|
||||
@@ -2544,7 +2529,6 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||
unsigned int nBytes = GetVirtualTransactionSize(txNew);
|
||||
|
||||
CTransaction txNewConst(txNew);
|
||||
dPriority = txNewConst.ComputePriority(dPriority, nBytes);
|
||||
|
||||
// Remove scriptSigs to eliminate the fee calculation dummy signatures
|
||||
for (auto& vin : txNew.vin) {
|
||||
@@ -2557,16 +2541,6 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||
if (coinControl && coinControl->nConfirmTarget > 0)
|
||||
currentConfirmationTarget = coinControl->nConfirmTarget;
|
||||
|
||||
// Can we complete this as a free transaction?
|
||||
if (fSendFreeTransactions && nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE)
|
||||
{
|
||||
// Not enough fee: enough priority?
|
||||
double dPriorityNeeded = mempool.estimateSmartPriority(currentConfirmationTarget);
|
||||
// Require at least hard-coded AllowFree.
|
||||
if (dPriority >= dPriorityNeeded && AllowFree(dPriority))
|
||||
break;
|
||||
}
|
||||
|
||||
CAmount nFeeNeeded = GetMinimumFee(nBytes, currentConfirmationTarget, mempool);
|
||||
if (coinControl && nFeeNeeded > 0 && coinControl->nMinimumTotalFee > nFeeNeeded) {
|
||||
nFeeNeeded = coinControl->nMinimumTotalFee;
|
||||
@@ -2655,7 +2629,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||
if (GetBoolArg("-walletrejectlongchains", DEFAULT_WALLET_REJECT_LONG_CHAINS)) {
|
||||
// Lastly, ensure this tx will pass the mempool's chain limits
|
||||
LockPoints lp;
|
||||
CTxMemPoolEntry entry(wtxNew.tx, 0, 0, 0, 0, 0, false, 0, lp);
|
||||
CTxMemPoolEntry entry(wtxNew.tx, 0, 0, 0, false, 0, lp);
|
||||
CTxMemPool::setEntries setAncestors;
|
||||
size_t nLimitAncestors = GetArg("-limitancestorcount", DEFAULT_ANCESTOR_LIMIT);
|
||||
size_t nLimitAncestorSize = GetArg("-limitancestorsize", DEFAULT_ANCESTOR_SIZE_LIMIT)*1000;
|
||||
@@ -3548,8 +3522,6 @@ std::string CWallet::GetWalletHelpString(bool showDebug)
|
||||
CURRENCY_UNIT, FormatMoney(payTxFee.GetFeePerK())));
|
||||
strUsage += HelpMessageOpt("-rescan", _("Rescan the block chain for missing wallet transactions on startup"));
|
||||
strUsage += HelpMessageOpt("-salvagewallet", _("Attempt to recover private keys from a corrupt wallet on startup"));
|
||||
if (showDebug)
|
||||
strUsage += HelpMessageOpt("-sendfreetransactions", strprintf(_("Send transactions as zero-fee transactions if possible (default: %u)"), DEFAULT_SEND_FREE_TRANSACTIONS));
|
||||
strUsage += HelpMessageOpt("-spendzeroconfchange", strprintf(_("Spend unconfirmed change when sending transactions (default: %u)"), DEFAULT_SPEND_ZEROCONF_CHANGE));
|
||||
strUsage += HelpMessageOpt("-txconfirmtarget=<n>", strprintf(_("If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)"), DEFAULT_TX_CONFIRM_TARGET));
|
||||
strUsage += HelpMessageOpt("-usehd", _("Use hierarchical deterministic key generation (HD) after BIP32. Only has effect during wallet creation/first start") + " " + strprintf(_("(default: %u)"), DEFAULT_USE_HD_WALLET));
|
||||
@@ -3870,12 +3842,8 @@ bool CWallet::ParameterInteraction()
|
||||
}
|
||||
nTxConfirmTarget = GetArg("-txconfirmtarget", DEFAULT_TX_CONFIRM_TARGET);
|
||||
bSpendZeroConfChange = GetBoolArg("-spendzeroconfchange", DEFAULT_SPEND_ZEROCONF_CHANGE);
|
||||
fSendFreeTransactions = GetBoolArg("-sendfreetransactions", DEFAULT_SEND_FREE_TRANSACTIONS);
|
||||
fWalletRbf = GetBoolArg("-walletrbf", DEFAULT_WALLET_RBF);
|
||||
|
||||
if (fSendFreeTransactions && GetArg("-limitfreerelay", DEFAULT_LIMITFREERELAY) <= 0)
|
||||
return InitError("Creation of free transactions with their relay disabled is not supported.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user