Merge pull request #2439 from rnicoll/1.14.4-dust-limit-type-alt

Use CAmount for amounts
This commit is contained in:
Ross Nicoll 2021-08-09 22:50:31 +01:00 committed by GitHub
commit 6150f6717a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 9 deletions

View file

@ -209,7 +209,7 @@ bool IsWitnessStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs)
CFeeRate incrementalRelayFee = CFeeRate(DEFAULT_INCREMENTAL_RELAY_FEE); CFeeRate incrementalRelayFee = CFeeRate(DEFAULT_INCREMENTAL_RELAY_FEE);
CFeeRate dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE); CFeeRate dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE);
unsigned int nBytesPerSigOp = DEFAULT_BYTES_PER_SIGOP; unsigned int nBytesPerSigOp = DEFAULT_BYTES_PER_SIGOP;
unsigned int nDustLimit = DEFAULT_DUST_LIMIT; CAmount nDustLimit = DEFAULT_DUST_LIMIT;
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost) int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost)
{ {

View file

@ -31,7 +31,7 @@ static const unsigned int MAX_STANDARD_TX_SIGOPS_COST = MAX_BLOCK_SIGOPS_COST/5;
/** Default for -maxmempool, maximum megabytes of mempool memory usage */ /** Default for -maxmempool, maximum megabytes of mempool memory usage */
static const unsigned int DEFAULT_MAX_MEMPOOL_SIZE = 300; static const unsigned int DEFAULT_MAX_MEMPOOL_SIZE = 300;
/** Default for -incrementalrelayfee, which sets the minimum feerate increase for mempool limiting or BIP 125 replacement **/ /** Default for -incrementalrelayfee, which sets the minimum feerate increase for mempool limiting or BIP 125 replacement **/
static const unsigned int DEFAULT_INCREMENTAL_RELAY_FEE = 1000; static const CAmount DEFAULT_INCREMENTAL_RELAY_FEE = 1000;
/** Default for -bytespersigop */ /** Default for -bytespersigop */
static const unsigned int DEFAULT_BYTES_PER_SIGOP = 20; static const unsigned int DEFAULT_BYTES_PER_SIGOP = 20;
/** The maximum number of witness stack items in a standard P2WSH script */ /** The maximum number of witness stack items in a standard P2WSH script */
@ -45,13 +45,13 @@ static const unsigned int MAX_STANDARD_P2WSH_SCRIPT_SIZE = 3600;
* standard and should be done with care and ideally rarely. It makes sense to * standard and should be done with care and ideally rarely. It makes sense to
* only increase the dust limit after prior releases were already not creating * only increase the dust limit after prior releases were already not creating
* outputs below the new threshold */ * outputs below the new threshold */
static const unsigned int DUST_RELAY_TX_FEE = COIN / 100000; static const CAmount DUST_RELAY_TX_FEE = COIN / 100000;
/** /**
* Dogecoin: Default dust limit that is evaluated when considering whether a * Dogecoin: Default dust limit that is evaluated when considering whether a
* transaction output is required to pay additional fee for relay and inclusion * transaction output is required to pay additional fee for relay and inclusion
* in blocks. Overridden by -dustlimit * in blocks. Overridden by -dustlimit
*/ */
static const unsigned int DEFAULT_DUST_LIMIT = COIN / 1; static const CAmount DEFAULT_DUST_LIMIT = COIN / 1;
/** /**
* Standard script verification flags that standard transactions will comply * Standard script verification flags that standard transactions will comply
@ -103,7 +103,7 @@ bool IsWitnessStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs)
extern CFeeRate incrementalRelayFee; extern CFeeRate incrementalRelayFee;
extern CFeeRate dustRelayFee; extern CFeeRate dustRelayFee;
extern unsigned int nBytesPerSigOp; extern unsigned int nBytesPerSigOp;
extern unsigned int nDustLimit; extern CAmount nDustLimit;
/** Compute the virtual transaction size (weight reinterpreted as bytes). */ /** Compute the virtual transaction size (weight reinterpreted as bytes). */
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost); int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost);

View file

@ -15,7 +15,8 @@ static const int SERIALIZE_TRANSACTION_NO_WITNESS = 0x40000000;
static const int WITNESS_SCALE_FACTOR = 4; static const int WITNESS_SCALE_FACTOR = 4;
extern unsigned int nDustLimit; /** An amount smaller than this is considered dust */
extern CAmount nDustLimit;
/** An outpoint - a combination of a transaction hash and an index n into its vout */ /** An outpoint - a combination of a transaction hash and an index n into its vout */
class COutPoint class COutPoint

View file

@ -54,7 +54,7 @@ static const bool DEFAULT_WHITELISTRELAY = true;
/** Default for DEFAULT_WHITELISTFORCERELAY. */ /** Default for DEFAULT_WHITELISTFORCERELAY. */
static const bool DEFAULT_WHITELISTFORCERELAY = true; static const bool DEFAULT_WHITELISTFORCERELAY = true;
/** Default for -minrelaytxfee, minimum relay fee for transactions */ /** Default for -minrelaytxfee, minimum relay fee for transactions */
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = COIN; static const CAmount DEFAULT_MIN_RELAY_TX_FEE = COIN;
//! -maxtxfee default //! -maxtxfee default
static const CAmount DEFAULT_TRANSACTION_MAXFEE = 400 * COIN; static const CAmount DEFAULT_TRANSACTION_MAXFEE = 400 * COIN;
//! Discourage users to set fees higher than this amount (in satoshis) per kB //! Discourage users to set fees higher than this amount (in satoshis) per kB

View file

@ -36,7 +36,7 @@ std::vector<std::unique_ptr<CWalletTx>> wtxn;
typedef set<pair<const CWalletTx*,unsigned int> > CoinSet; typedef set<pair<const CWalletTx*,unsigned int> > CoinSet;
extern unsigned int nDustLimit; extern CAmount nDustLimit;
BOOST_FIXTURE_TEST_SUITE(wallet_tests, WalletTestingSetup) BOOST_FIXTURE_TEST_SUITE(wallet_tests, WalletTestingSetup)

View file

@ -54,7 +54,7 @@ static const CAmount DEFAULT_FALLBACK_FEE = COIN;
//! -mintxfee default //! -mintxfee default
static const CAmount DEFAULT_TRANSACTION_MINFEE = COIN; static const CAmount DEFAULT_TRANSACTION_MINFEE = COIN;
//mlumin 5/2021: adding a minimum Wallet fee vs relay, currently still 1 COIN, to be reduced. //mlumin 5/2021: adding a minimum Wallet fee vs relay, currently still 1 COIN, to be reduced.
static const unsigned int DEFAULT_MIN_WALLET_TX_FEE = COIN; static const CAmount DEFAULT_MIN_WALLET_TX_FEE = COIN;
//! minimum recommended increment for BIP 125 replacement txs //! minimum recommended increment for BIP 125 replacement txs
static const CAmount WALLET_INCREMENTAL_RELAY_FEE = COIN/10 * 5; static const CAmount WALLET_INCREMENTAL_RELAY_FEE = COIN/10 * 5;
//! target minimum change amount //! target minimum change amount