aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-10-05 09:43:16 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-10-05 09:43:23 +0200
commit816e15ee81a2029cde6b4f9fe6fb93e75478c903 (patch)
tree5040ecbd5a6d9e24a3950f8bf6a0ea6d953ce1b4
parent9e530c6352c3e3d4f2936bbbb1bcb34ff9ca6378 (diff)
parent9d0379cea6c164610d05287ae6dd4e66f35b92b3 (diff)
downloadbitcoin-816e15ee81a2029cde6b4f9fe6fb93e75478c903.tar.xz
Merge bitcoin/bitcoin#22951: consensus: move amount.h into consensus
9d0379cea6c164610d05287ae6dd4e66f35b92b3 consensus: use <cstdint> over <stdint.h> in amount.h (fanquake) 863e52fe63a67fa020fb1ef527b9095a35ab77a5 consensus: make COIN & MAX_MONEY constexpr (fanquake) d09071da5bc997f2de1f55ca7a9babc3d7619329 [MOVEONLY] consensus: move amount.h into consensus (fanquake) Pull request description: A first step (of a few) towards some source code reorganization, as well as making libbitcoinconsensus slightly more self contained. Related to #15732. ACKs for top commit: MarcoFalke: concept ACK 9d0379cea6c164610d05287ae6dd4e66f35b92b 🏝 Tree-SHA512: 97fc79262dcb8c00996852a288fee69ddf8398ae2c95700bba5b326f1f38ffcfaf8fa66e29d0cb446d9b3f4e608a96525fae0c2ad9cd531ad98ad2a4a687cd6a
-rw-r--r--src/Makefile.am2
-rw-r--r--src/bitcoin-tx.cpp1
-rw-r--r--src/consensus/amount.h (renamed from src/amount.h)12
-rw-r--r--src/consensus/tx_check.cpp1
-rw-r--r--src/consensus/tx_verify.cpp1
-rw-r--r--src/consensus/tx_verify.h2
-rw-r--r--src/core_io.h2
-rw-r--r--src/core_write.cpp1
-rw-r--r--src/init.cpp2
-rw-r--r--src/interfaces/node.h2
-rw-r--r--src/interfaces/wallet.h2
-rw-r--r--src/miner.cpp2
-rw-r--r--src/net.h2
-rw-r--r--src/net_processing.cpp1
-rw-r--r--src/node/coinstats.h2
-rw-r--r--src/node/psbt.cpp2
-rw-r--r--src/policy/feerate.h2
-rw-r--r--src/policy/fees.h2
-rw-r--r--src/primitives/transaction.cpp1
-rw-r--r--src/primitives/transaction.h2
-rw-r--r--src/qt/bitcoinamountfield.h2
-rw-r--r--src/qt/bitcoingui.h2
-rw-r--r--src/qt/bitcoinunits.cpp2
-rw-r--r--src/qt/bitcoinunits.h2
-rw-r--r--src/qt/coincontroldialog.h2
-rw-r--r--src/qt/guiutil.h2
-rw-r--r--src/qt/optionsmodel.h1
-rw-r--r--src/qt/sendcoinsrecipient.h2
-rw-r--r--src/qt/transactionfilterproxy.h2
-rw-r--r--src/qt/transactionrecord.h2
-rw-r--r--src/qt/walletmodeltransaction.h2
-rw-r--r--src/qt/walletview.h2
-rw-r--r--src/rpc/blockchain.cpp2
-rw-r--r--src/rpc/blockchain.h2
-rw-r--r--src/rpc/mining.cpp2
-rw-r--r--src/rpc/rawtransaction.cpp1
-rw-r--r--src/rpc/rawtransaction_util.cpp1
-rw-r--r--src/rpc/server.h1
-rw-r--r--src/rpc/util.cpp1
-rw-r--r--src/script/sign.cpp1
-rw-r--r--src/test/amount_tests.cpp2
-rw-r--r--src/test/fuzz/coins_view.cpp2
-rw-r--r--src/test/fuzz/fee_rate.cpp2
-rw-r--r--src/test/fuzz/fees.cpp2
-rw-r--r--src/test/fuzz/integer.cpp2
-rw-r--r--src/test/fuzz/script_flags.cpp1
-rw-r--r--src/test/fuzz/util.cpp1
-rw-r--r--src/test/fuzz/util.h2
-rw-r--r--src/test/policy_fee_tests.cpp2
-rw-r--r--src/test/transaction_tests.cpp1
-rw-r--r--src/test/validation_tests.cpp1
-rw-r--r--src/txmempool.h2
-rw-r--r--src/util/moneystr.cpp2
-rw-r--r--src/util/moneystr.h2
-rw-r--r--src/validation.cpp1
-rw-r--r--src/validation.h2
-rw-r--r--src/wallet/coinselection.cpp1
-rw-r--r--src/wallet/coinselection.h2
-rw-r--r--src/wallet/fees.h2
-rw-r--r--src/wallet/interfaces.cpp2
-rw-r--r--src/wallet/receive.cpp1
-rw-r--r--src/wallet/receive.h2
-rw-r--r--src/wallet/rpcwallet.cpp2
-rw-r--r--src/wallet/spend.cpp1
-rw-r--r--src/wallet/spend.h1
-rw-r--r--src/wallet/test/coinselector_tests.cpp2
-rw-r--r--src/wallet/test/spend_tests.cpp1
-rw-r--r--src/wallet/transaction.h2
-rw-r--r--src/wallet/wallet.cpp1
-rw-r--r--src/wallet/wallet.h2
-rw-r--r--src/wallet/walletdb.h1
71 files changed, 74 insertions, 54 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index e038a0b132..b366252ba3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -499,9 +499,9 @@ crypto_libbitcoin_crypto_shani_a_SOURCES = crypto/sha256_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 \
+ consensus/amount.h \
consensus/merkle.cpp \
consensus/merkle.h \
consensus/params.h \
diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp
index 98916460aa..fc3bc6aa71 100644
--- a/src/bitcoin-tx.cpp
+++ b/src/bitcoin-tx.cpp
@@ -8,6 +8,7 @@
#include <clientversion.h>
#include <coins.h>
+#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <core_io.h>
#include <key_io.h>
diff --git a/src/amount.h b/src/consensus/amount.h
index 47968e80b1..8b41a2277d 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 <stdint.h>
+#include <cstdint>
/** 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 bb8cd10c63..de4824fadc 100644
--- a/src/consensus/tx_check.cpp
+++ b/src/consensus/tx_check.cpp
@@ -4,6 +4,7 @@
#include <consensus/tx_check.h>
+#include <consensus/amount.h>
#include <primitives/transaction.h>
#include <consensus/validation.h>
diff --git a/src/consensus/tx_verify.cpp b/src/consensus/tx_verify.cpp
index 0ab790ccdc..a07adae536 100644
--- a/src/consensus/tx_verify.cpp
+++ b/src/consensus/tx_verify.cpp
@@ -4,6 +4,7 @@
#include <consensus/tx_verify.h>
+#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <primitives/transaction.h>
#include <script/interpreter.h>
diff --git a/src/consensus/tx_verify.h b/src/consensus/tx_verify.h
index 264433c33d..777556808a 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 <amount.h>
+#include <consensus/amount.h>
#include <stdint.h>
#include <vector>
diff --git a/src/core_io.h b/src/core_io.h
index f00f155249..be93a17efe 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 <amount.h>
+#include <consensus/amount.h>
#include <attributes.h>
#include <string>
diff --git a/src/core_write.cpp b/src/core_write.cpp
index d92c970cb6..6b13e4c586 100644
--- a/src/core_write.cpp
+++ b/src/core_write.cpp
@@ -4,6 +4,7 @@
#include <core_io.h>
+#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <consensus/validation.h>
#include <key_io.h>
diff --git a/src/init.cpp b/src/init.cpp
index e1dbf2c08d..4495ded64d 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -10,12 +10,12 @@
#include <init.h>
#include <addrman.h>
-#include <amount.h>
#include <banman.h>
#include <blockfilter.h>
#include <chain.h>
#include <chainparams.h>
#include <compat/sanity.h>
+#include <consensus/amount.h>
#include <deploymentstatus.h>
#include <fs.h>
#include <hash.h>
diff --git a/src/interfaces/node.h b/src/interfaces/node.h
index 770b1b8753..34fdde3774 100644
--- a/src/interfaces/node.h
+++ b/src/interfaces/node.h
@@ -5,7 +5,7 @@
#ifndef BITCOIN_INTERFACES_NODE_H
#define BITCOIN_INTERFACES_NODE_H
-#include <amount.h> // For CAmount
+#include <consensus/amount.h>
#include <external_signer.h>
#include <net.h> // For NodeId
#include <net_types.h> // For banmap_t
diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h
index 6766e0510f..490563426c 100644
--- a/src/interfaces/wallet.h
+++ b/src/interfaces/wallet.h
@@ -5,7 +5,7 @@
#ifndef BITCOIN_INTERFACES_WALLET_H
#define BITCOIN_INTERFACES_WALLET_H
-#include <amount.h> // For CAmount
+#include <consensus/amount.h>
#include <interfaces/chain.h> // For ChainClient
#include <pubkey.h> // For CKeyID and CScriptID (definitions needed in CTxDestination instantiation)
#include <script/standard.h> // For CTxDestination
diff --git a/src/miner.cpp b/src/miner.cpp
index 33d115f279..1ef246cd14 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -5,10 +5,10 @@
#include <miner.h>
-#include <amount.h>
#include <chain.h>
#include <chainparams.h>
#include <coins.h>
+#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <consensus/merkle.h>
#include <consensus/tx_verify.h>
diff --git a/src/net.h b/src/net.h
index 0a72ca888d..a97ed9946d 100644
--- a/src/net.h
+++ b/src/net.h
@@ -7,10 +7,10 @@
#define BITCOIN_NET_H
#include <addrman.h>
-#include <amount.h>
#include <bloom.h>
#include <chainparams.h>
#include <compat.h>
+#include <consensus/amount.h>
#include <crypto/siphash.h>
#include <hash.h>
#include <i2p.h>
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 008b4d679c..aaad34be66 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -10,6 +10,7 @@
#include <blockencodings.h>
#include <blockfilter.h>
#include <chainparams.h>
+#include <consensus/amount.h>
#include <consensus/validation.h>
#include <deploymentstatus.h>
#include <hash.h>
diff --git a/src/node/coinstats.h b/src/node/coinstats.h
index 69e856dd15..9e9503ff5d 100644
--- a/src/node/coinstats.h
+++ b/src/node/coinstats.h
@@ -6,9 +6,9 @@
#ifndef BITCOIN_NODE_COINSTATS_H
#define BITCOIN_NODE_COINSTATS_H
-#include <amount.h>
#include <chain.h>
#include <coins.h>
+#include <consensus/amount.h>
#include <streams.h>
#include <uint256.h>
diff --git a/src/node/psbt.cpp b/src/node/psbt.cpp
index b013b6d579..9ad65d15d2 100644
--- a/src/node/psbt.cpp
+++ b/src/node/psbt.cpp
@@ -2,8 +2,8 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include <amount.h>
#include <coins.h>
+#include <consensus/amount.h>
#include <consensus/tx_verify.h>
#include <node/psbt.h>
#include <policy/policy.h>
diff --git a/src/policy/feerate.h b/src/policy/feerate.h
index d296d32774..b16f3f8251 100644
--- a/src/policy/feerate.h
+++ b/src/policy/feerate.h
@@ -6,7 +6,7 @@
#ifndef BITCOIN_POLICY_FEERATE_H
#define BITCOIN_POLICY_FEERATE_H
-#include <amount.h>
+#include <consensus/amount.h>
#include <serialize.h>
#include <string>
diff --git a/src/policy/fees.h b/src/policy/fees.h
index c444d71a31..27f9120c64 100644
--- a/src/policy/fees.h
+++ b/src/policy/fees.h
@@ -5,7 +5,7 @@
#ifndef BITCOIN_POLICY_FEES_H
#define BITCOIN_POLICY_FEES_H
-#include <amount.h>
+#include <consensus/amount.h>
#include <policy/feerate.h>
#include <uint256.h>
#include <random.h>
diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp
index 245206b906..a871912225 100644
--- a/src/primitives/transaction.cpp
+++ b/src/primitives/transaction.cpp
@@ -5,6 +5,7 @@
#include <primitives/transaction.h>
+#include <consensus/amount.h>
#include <hash.h>
#include <tinyformat.h>
#include <util/strencodings.h>
diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h
index 6bf36ee854..46db39f8db 100644
--- a/src/primitives/transaction.h
+++ b/src/primitives/transaction.h
@@ -7,7 +7,7 @@
#define BITCOIN_PRIMITIVES_TRANSACTION_H
#include <stdint.h>
-#include <amount.h>
+#include <consensus/amount.h>
#include <script/script.h>
#include <serialize.h>
#include <uint256.h>
diff --git a/src/qt/bitcoinamountfield.h b/src/qt/bitcoinamountfield.h
index c60d9a2c90..4855ada513 100644
--- a/src/qt/bitcoinamountfield.h
+++ b/src/qt/bitcoinamountfield.h
@@ -5,7 +5,7 @@
#ifndef BITCOIN_QT_BITCOINAMOUNTFIELD_H
#define BITCOIN_QT_BITCOINAMOUNTFIELD_H
-#include <amount.h>
+#include <consensus/amount.h>
#include <QWidget>
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index 27045f5cc3..fa7ae4b87d 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -12,7 +12,7 @@
#include <qt/guiutil.h>
#include <qt/optionsdialog.h>
-#include <amount.h>
+#include <consensus/amount.h>
#include <QLabel>
#include <QMainWindow>
diff --git a/src/qt/bitcoinunits.cpp b/src/qt/bitcoinunits.cpp
index 9660ba99f7..66d5eea7ac 100644
--- a/src/qt/bitcoinunits.cpp
+++ b/src/qt/bitcoinunits.cpp
@@ -4,6 +4,8 @@
#include <qt/bitcoinunits.h>
+#include <consensus/amount.h>
+
#include <QStringList>
#include <cassert>
diff --git a/src/qt/bitcoinunits.h b/src/qt/bitcoinunits.h
index e22ba0a938..e78a347bb1 100644
--- a/src/qt/bitcoinunits.h
+++ b/src/qt/bitcoinunits.h
@@ -5,7 +5,7 @@
#ifndef BITCOIN_QT_BITCOINUNITS_H
#define BITCOIN_QT_BITCOINUNITS_H
-#include <amount.h>
+#include <consensus/amount.h>
#include <QAbstractListModel>
#include <QString>
diff --git a/src/qt/coincontroldialog.h b/src/qt/coincontroldialog.h
index bcaf45df42..ec2619d115 100644
--- a/src/qt/coincontroldialog.h
+++ b/src/qt/coincontroldialog.h
@@ -5,7 +5,7 @@
#ifndef BITCOIN_QT_COINCONTROLDIALOG_H
#define BITCOIN_QT_COINCONTROLDIALOG_H
-#include <amount.h>
+#include <consensus/amount.h>
#include <QAbstractButton>
#include <QAction>
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h
index 274f0bdcbf..6287f95192 100644
--- a/src/qt/guiutil.h
+++ b/src/qt/guiutil.h
@@ -5,7 +5,7 @@
#ifndef BITCOIN_QT_GUIUTIL_H
#define BITCOIN_QT_GUIUTIL_H
-#include <amount.h>
+#include <consensus/amount.h>
#include <fs.h>
#include <net.h>
#include <netaddress.h>
diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h
index 65544acfbd..8f1513e48d 100644
--- a/src/qt/optionsmodel.h
+++ b/src/qt/optionsmodel.h
@@ -5,7 +5,6 @@
#ifndef BITCOIN_QT_OPTIONSMODEL_H
#define BITCOIN_QT_OPTIONSMODEL_H
-#include <amount.h>
#include <cstdint>
#include <qt/guiconstants.h>
diff --git a/src/qt/sendcoinsrecipient.h b/src/qt/sendcoinsrecipient.h
index 01135cdfef..c23afcab24 100644
--- a/src/qt/sendcoinsrecipient.h
+++ b/src/qt/sendcoinsrecipient.h
@@ -9,7 +9,7 @@
#include <config/bitcoin-config.h>
#endif
-#include <amount.h>
+#include <consensus/amount.h>
#include <serialize.h>
#include <string>
diff --git a/src/qt/transactionfilterproxy.h b/src/qt/transactionfilterproxy.h
index 09bc9e75db..270b8ef78c 100644
--- a/src/qt/transactionfilterproxy.h
+++ b/src/qt/transactionfilterproxy.h
@@ -5,7 +5,7 @@
#ifndef BITCOIN_QT_TRANSACTIONFILTERPROXY_H
#define BITCOIN_QT_TRANSACTIONFILTERPROXY_H
-#include <amount.h>
+#include <consensus/amount.h>
#include <QDateTime>
#include <QSortFilterProxyModel>
diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h
index e10243a28a..fb88ca424f 100644
--- a/src/qt/transactionrecord.h
+++ b/src/qt/transactionrecord.h
@@ -5,7 +5,7 @@
#ifndef BITCOIN_QT_TRANSACTIONRECORD_H
#define BITCOIN_QT_TRANSACTIONRECORD_H
-#include <amount.h>
+#include <consensus/amount.h>
#include <uint256.h>
#include <QList>
diff --git a/src/qt/walletmodeltransaction.h b/src/qt/walletmodeltransaction.h
index 120d240d91..0bae4bade3 100644
--- a/src/qt/walletmodeltransaction.h
+++ b/src/qt/walletmodeltransaction.h
@@ -8,7 +8,7 @@
#include <primitives/transaction.h>
#include <qt/sendcoinsrecipient.h>
-#include <amount.h>
+#include <consensus/amount.h>
#include <QObject>
diff --git a/src/qt/walletview.h b/src/qt/walletview.h
index eebc163624..86a835c484 100644
--- a/src/qt/walletview.h
+++ b/src/qt/walletview.h
@@ -5,7 +5,7 @@
#ifndef BITCOIN_QT_WALLETVIEW_H
#define BITCOIN_QT_WALLETVIEW_H
-#include <amount.h>
+#include <consensus/amount.h>
#include <QStackedWidget>
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 3370afc75f..ac746de32f 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -5,11 +5,11 @@
#include <rpc/blockchain.h>
-#include <amount.h>
#include <blockfilter.h>
#include <chain.h>
#include <chainparams.h>
#include <coins.h>
+#include <consensus/amount.h>
#include <consensus/params.h>
#include <consensus/validation.h>
#include <core_io.h>
diff --git a/src/rpc/blockchain.h b/src/rpc/blockchain.h
index 4b0d855685..09e471afdd 100644
--- a/src/rpc/blockchain.h
+++ b/src/rpc/blockchain.h
@@ -5,7 +5,7 @@
#ifndef BITCOIN_RPC_BLOCKCHAIN_H
#define BITCOIN_RPC_BLOCKCHAIN_H
-#include <amount.h>
+#include <consensus/amount.h>
#include <streams.h>
#include <sync.h>
diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp
index 8cad51a710..518c41d12a 100644
--- a/src/rpc/mining.cpp
+++ b/src/rpc/mining.cpp
@@ -3,9 +3,9 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include <amount.h>
#include <chain.h>
#include <chainparams.h>
+#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <consensus/params.h>
#include <consensus/validation.h>
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index b32bc670b6..483717aa7a 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -5,6 +5,7 @@
#include <chain.h>
#include <coins.h>
+#include <consensus/amount.h>
#include <consensus/validation.h>
#include <core_io.h>
#include <index/txindex.h>
diff --git a/src/rpc/rawtransaction_util.cpp b/src/rpc/rawtransaction_util.cpp
index f21eddf56c..d550160260 100644
--- a/src/rpc/rawtransaction_util.cpp
+++ b/src/rpc/rawtransaction_util.cpp
@@ -6,6 +6,7 @@
#include <rpc/rawtransaction_util.h>
#include <coins.h>
+#include <consensus/amount.h>
#include <core_io.h>
#include <key_io.h>
#include <policy/policy.h>
diff --git a/src/rpc/server.h b/src/rpc/server.h
index 03967020c2..e6bb35fc33 100644
--- a/src/rpc/server.h
+++ b/src/rpc/server.h
@@ -6,7 +6,6 @@
#ifndef BITCOIN_RPC_SERVER_H
#define BITCOIN_RPC_SERVER_H
-#include <amount.h>
#include <rpc/request.h>
#include <rpc/util.h>
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp
index 2059628b54..2d7f5f2894 100644
--- a/src/rpc/util.cpp
+++ b/src/rpc/util.cpp
@@ -2,6 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include <consensus/amount.h>
#include <key_io.h>
#include <outputtype.h>
#include <rpc/util.h>
diff --git a/src/script/sign.cpp b/src/script/sign.cpp
index b912b00365..4cb2125747 100644
--- a/src/script/sign.cpp
+++ b/src/script/sign.cpp
@@ -5,6 +5,7 @@
#include <script/sign.h>
+#include <consensus/amount.h>
#include <key.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
diff --git a/src/test/amount_tests.cpp b/src/test/amount_tests.cpp
index 77b7758a17..114fe3907c 100644
--- a/src/test/amount_tests.cpp
+++ b/src/test/amount_tests.cpp
@@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include <amount.h>
+#include <consensus/amount.h>
#include <policy/feerate.h>
#include <limits>
diff --git a/src/test/fuzz/coins_view.cpp b/src/test/fuzz/coins_view.cpp
index bbdb2c6917..87e70861fa 100644
--- a/src/test/fuzz/coins_view.cpp
+++ b/src/test/fuzz/coins_view.cpp
@@ -2,10 +2,10 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include <amount.h>
#include <chainparams.h>
#include <chainparamsbase.h>
#include <coins.h>
+#include <consensus/amount.h>
#include <consensus/tx_check.h>
#include <consensus/tx_verify.h>
#include <consensus/validation.h>
diff --git a/src/test/fuzz/fee_rate.cpp b/src/test/fuzz/fee_rate.cpp
index dff0e58000..a852f8fb60 100644
--- a/src/test/fuzz/fee_rate.cpp
+++ b/src/test/fuzz/fee_rate.cpp
@@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include <amount.h>
+#include <consensus/amount.h>
#include <policy/feerate.h>
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
diff --git a/src/test/fuzz/fees.cpp b/src/test/fuzz/fees.cpp
index 61c7681bf9..b5a07c7ba3 100644
--- a/src/test/fuzz/fees.cpp
+++ b/src/test/fuzz/fees.cpp
@@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include <amount.h>
+#include <consensus/amount.h>
#include <policy/fees.h>
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
diff --git a/src/test/fuzz/integer.cpp b/src/test/fuzz/integer.cpp
index 5a732aeeff..b6c40809e3 100644
--- a/src/test/fuzz/integer.cpp
+++ b/src/test/fuzz/integer.cpp
@@ -2,9 +2,9 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include <amount.h>
#include <arith_uint256.h>
#include <compressor.h>
+#include <consensus/amount.h>
#include <consensus/merkle.h>
#include <core_io.h>
#include <crypto/common.h>
diff --git a/src/test/fuzz/script_flags.cpp b/src/test/fuzz/script_flags.cpp
index 1278dc87d4..43927772ae 100644
--- a/src/test/fuzz/script_flags.cpp
+++ b/src/test/fuzz/script_flags.cpp
@@ -2,6 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include <consensus/amount.h>
#include <pubkey.h>
#include <script/interpreter.h>
#include <streams.h>
diff --git a/src/test/fuzz/util.cpp b/src/test/fuzz/util.cpp
index 0d87f687d3..d83d2924bb 100644
--- a/src/test/fuzz/util.cpp
+++ b/src/test/fuzz/util.cpp
@@ -2,6 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include <consensus/amount.h>
#include <pubkey.h>
#include <test/fuzz/util.h>
#include <test/util/script.h>
diff --git a/src/test/fuzz/util.h b/src/test/fuzz/util.h
index bb017b3497..1bc6f1db45 100644
--- a/src/test/fuzz/util.h
+++ b/src/test/fuzz/util.h
@@ -5,12 +5,12 @@
#ifndef BITCOIN_TEST_FUZZ_UTIL_H
#define BITCOIN_TEST_FUZZ_UTIL_H
-#include <amount.h>
#include <arith_uint256.h>
#include <attributes.h>
#include <chainparamsbase.h>
#include <coins.h>
#include <compat.h>
+#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <merkleblock.h>
#include <net.h>
diff --git a/src/test/policy_fee_tests.cpp b/src/test/policy_fee_tests.cpp
index 4a15be6ca6..f9c7d04d6c 100644
--- a/src/test/policy_fee_tests.cpp
+++ b/src/test/policy_fee_tests.cpp
@@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include <amount.h>
+#include <consensus/amount.h>
#include <policy/fees.h>
#include <boost/test/unit_test.hpp>
diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp
index 24029ea02e..c813fbea32 100644
--- a/src/test/transaction_tests.cpp
+++ b/src/test/transaction_tests.cpp
@@ -8,6 +8,7 @@
#include <checkqueue.h>
#include <clientversion.h>
+#include <consensus/amount.h>
#include <consensus/tx_check.h>
#include <consensus/validation.h>
#include <core_io.h>
diff --git a/src/test/validation_tests.cpp b/src/test/validation_tests.cpp
index a0c2e76f00..ca52ecba2f 100644
--- a/src/test/validation_tests.cpp
+++ b/src/test/validation_tests.cpp
@@ -3,6 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <chainparams.h>
+#include <consensus/amount.h>
#include <net.h>
#include <signet.h>
#include <uint256.h>
diff --git a/src/txmempool.h b/src/txmempool.h
index 27ee0628a7..0be51db181 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -14,8 +14,8 @@
#include <utility>
#include <vector>
-#include <amount.h>
#include <coins.h>
+#include <consensus/amount.h>
#include <indirectmap.h>
#include <policy/feerate.h>
#include <policy/packages.h>
diff --git a/src/util/moneystr.cpp b/src/util/moneystr.cpp
index 95a919ad12..1aed7daacf 100644
--- a/src/util/moneystr.cpp
+++ b/src/util/moneystr.cpp
@@ -5,7 +5,7 @@
#include <util/moneystr.h>
-#include <amount.h>
+#include <consensus/amount.h>
#include <tinyformat.h>
#include <util/strencodings.h>
#include <util/string.h>
diff --git a/src/util/moneystr.h b/src/util/moneystr.h
index b71dffd0db..f37dc1cffd 100644
--- a/src/util/moneystr.h
+++ b/src/util/moneystr.h
@@ -9,8 +9,8 @@
#ifndef BITCOIN_UTIL_MONEYSTR_H
#define BITCOIN_UTIL_MONEYSTR_H
-#include <amount.h>
#include <attributes.h>
+#include <consensus/amount.h>
#include <optional>
#include <string>
diff --git a/src/validation.cpp b/src/validation.cpp
index 4504d2ca0a..880a01eb7d 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -9,6 +9,7 @@
#include <chain.h>
#include <chainparams.h>
#include <checkqueue.h>
+#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <consensus/merkle.h>
#include <consensus/tx_check.h>
diff --git a/src/validation.h b/src/validation.h
index b2282828ce..b10050f931 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -10,10 +10,10 @@
#include <config/bitcoin-config.h>
#endif
-#include <amount.h>
#include <arith_uint256.h>
#include <attributes.h>
#include <chain.h>
+#include <consensus/amount.h>
#include <fs.h>
#include <policy/feerate.h>
#include <policy/packages.h>
diff --git a/src/wallet/coinselection.cpp b/src/wallet/coinselection.cpp
index 8d08153501..e1ca3fb379 100644
--- a/src/wallet/coinselection.cpp
+++ b/src/wallet/coinselection.cpp
@@ -4,6 +4,7 @@
#include <wallet/coinselection.h>
+#include <consensus/amount.h>
#include <policy/feerate.h>
#include <util/check.h>
#include <util/system.h>
diff --git a/src/wallet/coinselection.h b/src/wallet/coinselection.h
index 78d877a10b..e7d467660f 100644
--- a/src/wallet/coinselection.h
+++ b/src/wallet/coinselection.h
@@ -5,7 +5,7 @@
#ifndef BITCOIN_WALLET_COINSELECTION_H
#define BITCOIN_WALLET_COINSELECTION_H
-#include <amount.h>
+#include <consensus/amount.h>
#include <policy/feerate.h>
#include <primitives/transaction.h>
#include <random.h>
diff --git a/src/wallet/fees.h b/src/wallet/fees.h
index 434f211dc2..d6d625d9c1 100644
--- a/src/wallet/fees.h
+++ b/src/wallet/fees.h
@@ -6,7 +6,7 @@
#ifndef BITCOIN_WALLET_FEES_H
#define BITCOIN_WALLET_FEES_H
-#include <amount.h>
+#include <consensus/amount.h>
class CCoinControl;
class CFeeRate;
diff --git a/src/wallet/interfaces.cpp b/src/wallet/interfaces.cpp
index d9fc6de79b..7d0cdb6934 100644
--- a/src/wallet/interfaces.cpp
+++ b/src/wallet/interfaces.cpp
@@ -4,7 +4,7 @@
#include <interfaces/wallet.h>
-#include <amount.h>
+#include <consensus/amount.h>
#include <interfaces/chain.h>
#include <interfaces/handler.h>
#include <policy/fees.h>
diff --git a/src/wallet/receive.cpp b/src/wallet/receive.cpp
index 98706dcdf8..2fb274b55f 100644
--- a/src/wallet/receive.cpp
+++ b/src/wallet/receive.cpp
@@ -2,6 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <wallet/receive.h>
#include <wallet/transaction.h>
diff --git a/src/wallet/receive.h b/src/wallet/receive.h
index b4b311636b..f659955fc6 100644
--- a/src/wallet/receive.h
+++ b/src/wallet/receive.h
@@ -5,7 +5,7 @@
#ifndef BITCOIN_WALLET_RECEIVE_H
#define BITCOIN_WALLET_RECEIVE_H
-#include <amount.h>
+#include <consensus/amount.h>
#include <wallet/ismine.h>
#include <wallet/transaction.h>
#include <wallet/wallet.h>
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index aa97b748b1..39cde4e4ec 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -3,7 +3,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include <amount.h>
+#include <consensus/amount.h>
#include <core_io.h>
#include <interfaces/chain.h>
#include <key_io.h>
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
index 43fcc0416d..5bed09e067 100644
--- a/src/wallet/spend.cpp
+++ b/src/wallet/spend.cpp
@@ -2,6 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include <consensus/amount.h>
#include <consensus/validation.h>
#include <interfaces/chain.h>
#include <policy/policy.h>
diff --git a/src/wallet/spend.h b/src/wallet/spend.h
index 3a723d9832..7467dd9fa3 100644
--- a/src/wallet/spend.h
+++ b/src/wallet/spend.h
@@ -5,6 +5,7 @@
#ifndef BITCOIN_WALLET_SPEND_H
#define BITCOIN_WALLET_SPEND_H
+#include <consensus/amount.h>
#include <wallet/coinselection.h>
#include <wallet/transaction.h>
#include <wallet/wallet.h>
diff --git a/src/wallet/test/coinselector_tests.cpp b/src/wallet/test/coinselector_tests.cpp
index 40d9e90d56..f80c4637b8 100644
--- a/src/wallet/test/coinselector_tests.cpp
+++ b/src/wallet/test/coinselector_tests.cpp
@@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include <amount.h>
+#include <consensus/amount.h>
#include <node/context.h>
#include <primitives/transaction.h>
#include <random.h>
diff --git a/src/wallet/test/spend_tests.cpp b/src/wallet/test/spend_tests.cpp
index e779b2450f..becef70729 100644
--- a/src/wallet/test/spend_tests.cpp
+++ b/src/wallet/test/spend_tests.cpp
@@ -2,6 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include <consensus/amount.h>
#include <policy/fees.h>
#include <validation.h>
#include <wallet/coincontrol.h>
diff --git a/src/wallet/transaction.h b/src/wallet/transaction.h
index 223901586e..6fc1bd1eed 100644
--- a/src/wallet/transaction.h
+++ b/src/wallet/transaction.h
@@ -5,7 +5,7 @@
#ifndef BITCOIN_WALLET_TRANSACTION_H
#define BITCOIN_WALLET_TRANSACTION_H
-#include <amount.h>
+#include <consensus/amount.h>
#include <primitives/transaction.h>
#include <serialize.h>
#include <wallet/ismine.h>
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index bf6d8e7510..abfe9d7dba 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -6,6 +6,7 @@
#include <wallet/wallet.h>
#include <chain.h>
+#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <consensus/validation.h>
#include <external_signer.h>
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index b949fe3040..767b24adbb 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -6,7 +6,7 @@
#ifndef BITCOIN_WALLET_WALLET_H
#define BITCOIN_WALLET_WALLET_H
-#include <amount.h>
+#include <consensus/amount.h>
#include <interfaces/chain.h>
#include <interfaces/handler.h>
#include <outputtype.h>
diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h
index 715d9012ed..9c752623b3 100644
--- a/src/wallet/walletdb.h
+++ b/src/wallet/walletdb.h
@@ -6,7 +6,6 @@
#ifndef BITCOIN_WALLET_WALLETDB_H
#define BITCOIN_WALLET_WALLETDB_H
-#include <amount.h>
#include <script/sign.h>
#include <wallet/db.h>
#include <wallet/walletutil.h>