From 672a38cc061f801b691d9a91cd720d0a414d2e63 Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Sat, 7 Aug 2021 07:44:32 +0100 Subject: [PATCH] Use CAmount for amounts Use CAmount rather than unsigned int for amounts for consistency with other fee rate amounts. This does change the type from unsigned int to unsigned int64, and while it is unlikely anyone would need a dust limit higher than unsigned int, again this ensures the theoretical maximum is in line with other rates. --- src/policy/policy.cpp | 2 +- src/policy/policy.h | 2 +- src/primitives/transaction.h | 3 ++- src/wallet/test/wallet_tests.cpp | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp index 7b2b23964..506eb6f17 100644 --- a/src/policy/policy.cpp +++ b/src/policy/policy.cpp @@ -209,7 +209,7 @@ bool IsWitnessStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs) CFeeRate incrementalRelayFee = CFeeRate(DEFAULT_INCREMENTAL_RELAY_FEE); CFeeRate dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE); 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) { diff --git a/src/policy/policy.h b/src/policy/policy.h index 5380f7b5b..a41d2fe5f 100644 --- a/src/policy/policy.h +++ b/src/policy/policy.h @@ -103,7 +103,7 @@ bool IsWitnessStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs) extern CFeeRate incrementalRelayFee; extern CFeeRate dustRelayFee; extern unsigned int nBytesPerSigOp; -extern unsigned int nDustLimit; +extern CAmount nDustLimit; /** Compute the virtual transaction size (weight reinterpreted as bytes). */ int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost); diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 0d0ceda54..63e34697a 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -15,7 +15,8 @@ static const int SERIALIZE_TRANSACTION_NO_WITNESS = 0x40000000; 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 */ class COutPoint diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp index 79a994bf6..a72e1ce09 100644 --- a/src/wallet/test/wallet_tests.cpp +++ b/src/wallet/test/wallet_tests.cpp @@ -36,7 +36,7 @@ std::vector> wtxn; typedef set > CoinSet; -extern unsigned int nDustLimit; +extern CAmount nDustLimit; BOOST_FIXTURE_TEST_SUITE(wallet_tests, WalletTestingSetup)