Match va_start and va_end calls, pointed by clang-tidy #176

Closed
bvbfan wants to merge 277 commits from va_brach into master
5 changed files with 17 additions and 4 deletions
Showing only changes of commit 4ff143387e - Show all commits

View file

@ -82,6 +82,7 @@ bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT;
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE;
CAmount minFeePerNameClaimChar = MIN_FEE_PER_NAMECLAIM_CHAR;
CTxMemPool mempool(::minRelayTxFee);
FeeFilterRounder filterRounder(::minRelayTxFee);
@ -1194,6 +1195,14 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
return state.DoS(0, false, REJECT_NONSTANDARD, "bad-txns-too-many-sigops", false,
strprintf("%d", nSigOps));
// If a ClaimTrie transaction, it must meet the minimum fee requirement due to
// it consuming extra system resources, compared to an ordinary transaction
CAmount minClaimTrieFee = CalcMinClaimTrieFee(tx, minFeePerNameClaimChar);
if (nModifiedFees < minClaimTrieFee) {
return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "minimum claim trie fee not met", false,
strprintf("%d < %d", nFees, minClaimTrieFee));
}
CAmount mempoolRejectFee = pool.GetMinFee(GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFee(nSize);
if (mempoolRejectFee > 0 && nModifiedFees < mempoolRejectFee) {
return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "mempool min fee not met", false, strprintf("%d < %d", nFees, mempoolRejectFee));
@ -1201,7 +1210,6 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
// Require that free transactions have sufficient priority to be mined in the next block.
return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "insufficient priority");
}
// Continuously rate-limit free (really, very-low-fee) transactions
// This mitigates 'penny-flooding' -- sending thousands of free transactions just to
// be annoying or make others' transactions take longer to confirm.

View file

@ -50,7 +50,7 @@ static const bool DEFAULT_WHITELISTFORCERELAY = true;
/** Default for -minrelaytxfee, minimum relay fee for transactions */
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000;
//! -maxtxfee default
static const CAmount DEFAULT_TRANSACTION_MAXFEE = 0.1 * COIN;
static const CAmount DEFAULT_TRANSACTION_MAXFEE = 1 * COIN;
//! Discourage users to set fees higher than this amount (in satoshis) per kB
static const CAmount HIGH_TX_FEE_PER_KB = 0.01 * COIN;
//! -maxtxfee will warn if called with a higher fee than this amount (in satoshis)
@ -163,6 +163,9 @@ extern size_t nCoinCacheUsage;
extern CFeeRate minRelayTxFee;
/** Absolute maximum transaction fee (in satoshis) used by wallet and mempool (rejects high fee in sendrawtransaction) */
extern CAmount maxTxFee;
/** Used to calculate minimum fee for claim trie transactions **/
extern CAmount minFeePerNameClaimChar;
/** If the tip is older than this (in seconds), the node is considered to be in initial block download. */
extern int64_t nMaxTipAge;
extern bool fEnableReplacement;

View file

@ -751,6 +751,4 @@ BOOST_AUTO_TEST_CASE(claimtriebranching_expire)
}
BOOST_AUTO_TEST_SUITE_END()

View file

@ -153,6 +153,7 @@ TestChain100Setup::~TestChain100Setup()
RegTestingSetup::RegTestingSetup() : TestingSetup(CBaseChainParams::REGTEST)
{
minRelayTxFee = CFeeRate(0);
minFeePerNameClaimChar = 0;
}
RegTestingSetup::~RegTestingSetup()

View file

@ -2279,6 +2279,9 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
if (coinControl && nFeeNeeded > 0 && coinControl->nMinimumTotalFee > nFeeNeeded) {
nFeeNeeded = coinControl->nMinimumTotalFee;
}
// Make sure we meet the minimum claimtrie fee, pick which ever one is largest
CAmount minClaimTrieFee = CalcMinClaimTrieFee(wtxNew, minFeePerNameClaimChar);
nFeeNeeded = std::max(nFeeNeeded, minClaimTrieFee);
// If we made it here and we aren't even able to meet the relay fee on the next pass, give up
// because we must be at the maximum allowed fee.