From 20d15056f1ae96aecd78e60afde36a25d20a5b6d Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Mon, 21 Oct 2024 17:59:23 +0000 Subject: [PATCH 01/10] merge bitcoin#22951: move amount.h into consensus --- src/Makefile.am | 2 +- src/addressindex.h | 2 +- src/coinjoin/common.h | 2 +- src/coinjoin/options.h | 3 ++- src/{ => consensus}/amount.h | 12 ++++++------ src/consensus/tx_check.cpp | 1 + src/consensus/tx_verify.h | 2 +- src/core_io.h | 2 +- src/core_write.cpp | 1 + src/evo/dmn_types.h | 2 +- src/governance/classes.h | 2 +- src/init.cpp | 2 +- src/interfaces/node.h | 2 +- src/interfaces/wallet.h | 2 +- src/masternode/payments.cpp | 2 +- src/masternode/payments.h | 2 +- src/miner.cpp | 2 +- src/net.h | 1 + src/net_processing.cpp | 1 + src/node/coinstats.h | 2 +- src/policy/feerate.h | 2 +- src/policy/fees.h | 2 +- src/primitives/transaction.cpp | 1 + src/primitives/transaction.h | 2 +- src/qt/bitcoinamountfield.h | 2 +- src/qt/bitcoingui.h | 2 +- src/qt/bitcoinunits.cpp | 2 ++ src/qt/bitcoinunits.h | 2 +- src/qt/coincontroldialog.h | 2 +- src/qt/guiutil.h | 2 +- src/qt/optionsmodel.h | 1 - src/qt/sendcoinsrecipient.h | 2 +- src/qt/transactionfilterproxy.h | 2 +- src/qt/transactionrecord.h | 2 +- src/qt/walletmodeltransaction.h | 2 +- src/qt/walletview.h | 2 +- src/rpc/blockchain.cpp | 2 +- src/rpc/blockchain.h | 2 +- src/rpc/index_util.h | 8 ++++---- src/rpc/mining.cpp | 2 +- src/rpc/rawtransaction.cpp | 1 + src/rpc/rawtransaction_util.cpp | 1 + src/rpc/server.h | 1 - src/rpc/util.cpp | 1 + src/script/sign.cpp | 1 + src/spentindex.h | 2 +- src/test/amount_tests.cpp | 2 +- src/test/evo_assetlocks_tests.cpp | 2 +- src/test/fuzz/coins_view.cpp | 2 +- src/test/fuzz/fee_rate.cpp | 2 +- src/test/fuzz/fees.cpp | 2 +- src/test/fuzz/integer.cpp | 1 + src/test/fuzz/script_flags.cpp | 1 + src/test/fuzz/util.h | 2 +- src/test/validation_tests.cpp | 1 + src/txmempool.h | 8 ++++---- src/util/moneystr.cpp | 2 +- src/util/moneystr.h | 2 +- src/util/system.h | 2 +- src/validation.cpp | 1 + src/validation.h | 2 +- src/wallet/coinselection.h | 2 +- src/wallet/fees.h | 2 +- src/wallet/interfaces.cpp | 2 +- src/wallet/rpcwallet.cpp | 2 +- src/wallet/test/coinjoin_tests.cpp | 2 +- src/wallet/test/coinselector_tests.cpp | 7 ++++--- src/wallet/wallet.cpp | 1 + src/wallet/wallet.h | 2 +- src/wallet/walletdb.h | 1 - 70 files changed, 83 insertions(+), 68 deletions(-) rename src/{ => consensus}/amount.h (80%) diff --git a/src/Makefile.am b/src/Makefile.am index 65bf28035af1b..1ba29a075cc4e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -699,11 +699,11 @@ crypto_libbitcoin_crypto_arm_shani_a_SOURCES = crypto/sha256_arm_shani.cpp libbitcoin_consensus_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) libbitcoin_consensus_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_consensus_a_SOURCES = \ - amount.h \ arith_uint256.cpp \ arith_uint256.h \ bls/bls.cpp \ bls/bls.h \ + consensus/amount.h \ consensus/merkle.cpp \ consensus/merkle.h \ consensus/params.h \ diff --git a/src/addressindex.h b/src/addressindex.h index b5cbcefc1f141..55dbc8284a58f 100644 --- a/src/addressindex.h +++ b/src/addressindex.h @@ -8,7 +8,7 @@ #ifndef BITCOIN_ADDRESSINDEX_H #define BITCOIN_ADDRESSINDEX_H -#include +#include #include #include #include diff --git a/src/coinjoin/common.h b/src/coinjoin/common.h index 165664c3d19f2..def3ffc83a420 100644 --- a/src/coinjoin/common.h +++ b/src/coinjoin/common.h @@ -5,7 +5,7 @@ #ifndef BITCOIN_COINJOIN_COMMON_H #define BITCOIN_COINJOIN_COMMON_H -#include +#include #include #include diff --git a/src/coinjoin/options.h b/src/coinjoin/options.h index 5c48a84a6e719..8782df0e1b8f0 100644 --- a/src/coinjoin/options.h +++ b/src/coinjoin/options.h @@ -5,7 +5,8 @@ #ifndef BITCOIN_COINJOIN_OPTIONS_H #define BITCOIN_COINJOIN_OPTIONS_H -#include +#include + #include #include diff --git a/src/amount.h b/src/consensus/amount.h similarity index 80% rename from src/amount.h rename to src/consensus/amount.h index 47968e80b1740..8b41a2277dfc1 100644 --- a/src/amount.h +++ b/src/consensus/amount.h @@ -3,15 +3,15 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef BITCOIN_AMOUNT_H -#define BITCOIN_AMOUNT_H +#ifndef BITCOIN_CONSENSUS_AMOUNT_H +#define BITCOIN_CONSENSUS_AMOUNT_H -#include +#include /** Amount in satoshis (Can be negative) */ typedef int64_t CAmount; -static const CAmount COIN = 100000000; +static constexpr CAmount COIN = 100000000; /** No amount larger than this (in satoshi) is valid. * @@ -22,7 +22,7 @@ static const CAmount COIN = 100000000; * critical; in unusual circumstances like a(nother) overflow bug that allowed * for the creation of coins out of thin air modification could lead to a fork. * */ -static const CAmount MAX_MONEY = 21000000 * COIN; +static constexpr CAmount MAX_MONEY = 21000000 * COIN; inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); } -#endif // BITCOIN_AMOUNT_H +#endif // BITCOIN_CONSENSUS_AMOUNT_H diff --git a/src/consensus/tx_check.cpp b/src/consensus/tx_check.cpp index 6300879914517..3908f483d073b 100644 --- a/src/consensus/tx_check.cpp +++ b/src/consensus/tx_check.cpp @@ -7,6 +7,7 @@ #include #include +#include #include #include diff --git a/src/consensus/tx_verify.h b/src/consensus/tx_verify.h index 4fbae4c540f65..76bbe683110e8 100644 --- a/src/consensus/tx_verify.h +++ b/src/consensus/tx_verify.h @@ -5,7 +5,7 @@ #ifndef BITCOIN_CONSENSUS_TX_VERIFY_H #define BITCOIN_CONSENSUS_TX_VERIFY_H -#include +#include #include #include diff --git a/src/core_io.h b/src/core_io.h index a24d7d5d7f081..c416dd8501fb7 100644 --- a/src/core_io.h +++ b/src/core_io.h @@ -5,7 +5,7 @@ #ifndef BITCOIN_CORE_IO_H #define BITCOIN_CORE_IO_H -#include +#include #include #include diff --git a/src/core_write.cpp b/src/core_write.cpp index a2cdf68aa4c0a..35f9bc2555912 100644 --- a/src/core_write.cpp +++ b/src/core_write.cpp @@ -4,6 +4,7 @@ #include +#include #include #include #include diff --git a/src/evo/dmn_types.h b/src/evo/dmn_types.h index edc36187dda6f..d532c6b3a6671 100644 --- a/src/evo/dmn_types.h +++ b/src/evo/dmn_types.h @@ -5,7 +5,7 @@ #ifndef BITCOIN_EVO_DMN_TYPES_H #define BITCOIN_EVO_DMN_TYPES_H -#include +#include #include #include diff --git a/src/governance/classes.h b/src/governance/classes.h index 3e42f2bdf09a0..030ae5f0502a3 100644 --- a/src/governance/classes.h +++ b/src/governance/classes.h @@ -4,7 +4,7 @@ #ifndef BITCOIN_GOVERNANCE_CLASSES_H #define BITCOIN_GOVERNANCE_CLASSES_H -#include +#include #include #include