aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Ofsky <ryan@ofsky.org>2023-12-06 16:43:49 -0500
committerRyan Ofsky <ryan@ofsky.org>2024-05-16 10:16:08 -0500
commit680eafdc74021c1e0893c3a62404e607fd4724f5 (patch)
treed1fe7bb7ad81db88b38d5af9081a0e5561ed9a11
parent02e62c6c9af4beabaeea58fb1ea3ad0dc5094678 (diff)
downloadbitcoin-680eafdc74021c1e0893c3a62404e607fd4724f5.tar.xz
util: move fees.h and error.h to common/messages.h
Move enum and message formatting functions to a common/messages header where they should be more discoverable, and also out of the util library, so they will not be a dependency of the kernel The are no changes in behavior and no changes to the moved code.
-rw-r--r--src/Makefile.am6
-rw-r--r--src/common/messages.cpp (renamed from src/util/error.cpp)65
-rw-r--r--src/common/messages.h36
-rw-r--r--src/init.cpp3
-rw-r--r--src/net_permissions.cpp4
-rw-r--r--src/node/mempool_args.cpp3
-rw-r--r--src/node/transaction.h2
-rw-r--r--src/qt/psbtoperationsdialog.cpp3
-rw-r--r--src/rpc/fees.cpp5
-rw-r--r--src/rpc/util.cpp3
-rw-r--r--src/test/fuzz/fees.cpp4
-rw-r--r--src/test/fuzz/kitchen_sink.cpp4
-rw-r--r--src/test/fuzz/string.cpp8
-rw-r--r--src/util/error.h38
-rw-r--r--src/util/fees.cpp67
-rw-r--r--src/util/fees.h18
-rw-r--r--src/wallet/rpc/spend.cpp7
-rw-r--r--src/wallet/scriptpubkeyman.h2
-rw-r--r--src/wallet/spend.cpp4
-rw-r--r--src/wallet/wallet.cpp4
20 files changed, 143 insertions, 143 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 36b9102712..15734762c0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -144,6 +144,7 @@ BITCOIN_CORE_H = \
compat/compat.h \
compat/cpuid.h \
compat/endian.h \
+ common/messages.h \
common/settings.h \
common/signmessage.h \
common/system.h \
@@ -300,11 +301,9 @@ BITCOIN_CORE_H = \
util/chaintype.h \
util/check.h \
util/epochguard.h \
- util/error.h \
util/exception.h \
util/fastrange.h \
util/feefrac.h \
- util/fees.h \
util/fs.h \
util/fs_helpers.h \
util/golombrice.h \
@@ -681,6 +680,7 @@ libbitcoin_common_a_SOURCES = \
common/config.cpp \
common/init.cpp \
common/interfaces.cpp \
+ common/messages.cpp \
common/run_command.cpp \
common/settings.cpp \
common/signmessage.cpp \
@@ -738,10 +738,8 @@ libbitcoin_util_a_SOURCES = \
util/bytevectorhash.cpp \
util/chaintype.cpp \
util/check.cpp \
- util/error.cpp \
util/exception.cpp \
util/feefrac.cpp \
- util/fees.cpp \
util/fs.cpp \
util/fs_helpers.cpp \
util/hasher.cpp \
diff --git a/src/util/error.cpp b/src/common/messages.cpp
index 9d506ee25c..5d68eb3d7f 100644
--- a/src/util/error.cpp
+++ b/src/common/messages.cpp
@@ -1,17 +1,75 @@
-// Copyright (c) 2010-2022 The Bitcoin Core developers
+// Copyright (c) 2009-2010 Satoshi Nakamoto
+// Copyright (c) 2009-2022 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include <util/error.h>
+#include <common/messages.h>
#include <common/types.h>
+#include <policy/fees.h>
#include <tinyformat.h>
+#include <util/strencodings.h>
+#include <util/string.h>
#include <util/translation.h>
#include <cassert>
+#include <map>
#include <string>
+#include <utility>
+#include <vector>
-using common::PSBTError;
+namespace common {
+std::string StringForFeeReason(FeeReason reason)
+{
+ static const std::map<FeeReason, std::string> fee_reason_strings = {
+ {FeeReason::NONE, "None"},
+ {FeeReason::HALF_ESTIMATE, "Half Target 60% Threshold"},
+ {FeeReason::FULL_ESTIMATE, "Target 85% Threshold"},
+ {FeeReason::DOUBLE_ESTIMATE, "Double Target 95% Threshold"},
+ {FeeReason::CONSERVATIVE, "Conservative Double Target longer horizon"},
+ {FeeReason::MEMPOOL_MIN, "Mempool Min Fee"},
+ {FeeReason::PAYTXFEE, "PayTxFee set"},
+ {FeeReason::FALLBACK, "Fallback fee"},
+ {FeeReason::REQUIRED, "Minimum Required Fee"},
+ };
+ auto reason_string = fee_reason_strings.find(reason);
+
+ if (reason_string == fee_reason_strings.end()) return "Unknown";
+
+ return reason_string->second;
+}
+
+const std::vector<std::pair<std::string, FeeEstimateMode>>& FeeModeMap()
+{
+ static const std::vector<std::pair<std::string, FeeEstimateMode>> FEE_MODES = {
+ {"unset", FeeEstimateMode::UNSET},
+ {"economical", FeeEstimateMode::ECONOMICAL},
+ {"conservative", FeeEstimateMode::CONSERVATIVE},
+ };
+ return FEE_MODES;
+}
+
+std::string FeeModes(const std::string& delimiter)
+{
+ return Join(FeeModeMap(), delimiter, [&](const std::pair<std::string, FeeEstimateMode>& i) { return i.first; });
+}
+
+std::string InvalidEstimateModeErrorMessage()
+{
+ return "Invalid estimate_mode parameter, must be one of: \"" + FeeModes("\", \"") + "\"";
+}
+
+bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_estimate_mode)
+{
+ auto searchkey = ToUpper(mode_string);
+ for (const auto& pair : FeeModeMap()) {
+ if (ToUpper(pair.first) == searchkey) {
+ fee_estimate_mode = pair.second;
+ return true;
+ }
+ }
+ return false;
+}
bilingual_str PSBTErrorString(PSBTError err)
{
@@ -74,3 +132,4 @@ bilingual_str AmountErrMsg(const std::string& optname, const std::string& strVal
{
return strprintf(_("Invalid amount for -%s=<amount>: '%s'"), optname, strValue);
}
+} // namespace common
diff --git a/src/common/messages.h b/src/common/messages.h
new file mode 100644
index 0000000000..bdd853791d
--- /dev/null
+++ b/src/common/messages.h
@@ -0,0 +1,36 @@
+// Copyright (c) 2009-2010 Satoshi Nakamoto
+// Copyright (c) 2009-2020 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+//! @file common/messages.h is a home for simple string functions returning
+//! descriptive messages that are used in RPC and GUI interfaces or log
+//! messages, and are called in different parts of the codebase across
+//! node/wallet/gui boundaries.
+
+#ifndef BITCOIN_COMMON_MESSAGES_H
+#define BITCOIN_COMMON_MESSAGES_H
+
+#include <node/types.h>
+#include <string>
+
+struct bilingual_str;
+
+enum class FeeEstimateMode;
+enum class FeeReason;
+
+namespace common {
+enum class PSBTError;
+bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_estimate_mode);
+std::string StringForFeeReason(FeeReason reason);
+std::string FeeModes(const std::string& delimiter);
+std::string InvalidEstimateModeErrorMessage();
+bilingual_str PSBTErrorString(PSBTError error);
+bilingual_str TransactionErrorString(const TransactionError error);
+bilingual_str ResolveErrMsg(const std::string& optname, const std::string& strBind);
+bilingual_str InvalidPortErrMsg(const std::string& optname, const std::string& strPort);
+bilingual_str AmountHighWarn(const std::string& optname);
+bilingual_str AmountErrMsg(const std::string& optname, const std::string& strValue);
+} // namespace common
+
+#endif // BITCOIN_COMMON_MESSAGES_H
diff --git a/src/init.cpp b/src/init.cpp
index 51ade4de93..080c79f3be 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -115,6 +115,9 @@
#include <zmq/zmqrpc.h>
#endif
+using common::AmountErrMsg;
+using common::InvalidPortErrMsg;
+using common::ResolveErrMsg;
using kernel::DumpMempool;
using kernel::LoadMempool;
using kernel::ValidationCacheSizes;
diff --git a/src/net_permissions.cpp b/src/net_permissions.cpp
index b01b2f643d..8f0042c141 100644
--- a/src/net_permissions.cpp
+++ b/src/net_permissions.cpp
@@ -2,12 +2,14 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include <common/messages.h>
#include <common/system.h>
#include <net_permissions.h>
#include <netbase.h>
-#include <util/error.h>
#include <util/translation.h>
+using common::ResolveErrMsg;
+
const std::vector<std::string> NET_PERMISSIONS_DOC{
"bloomfilter (allow requesting BIP37 filtered blocks and transactions)",
"noban (do not ban for misbehavior; implies download)",
diff --git a/src/node/mempool_args.cpp b/src/node/mempool_args.cpp
index ac26600919..f329affb1d 100644
--- a/src/node/mempool_args.cpp
+++ b/src/node/mempool_args.cpp
@@ -8,19 +8,20 @@
#include <kernel/mempool_options.h>
#include <common/args.h>
+#include <common/messages.h>
#include <consensus/amount.h>
#include <kernel/chainparams.h>
#include <logging.h>
#include <policy/feerate.h>
#include <policy/policy.h>
#include <tinyformat.h>
-#include <util/error.h>
#include <util/moneystr.h>
#include <util/translation.h>
#include <chrono>
#include <memory>
+using common::AmountErrMsg;
using kernel::MemPoolLimits;
using kernel::MemPoolOptions;
diff --git a/src/node/transaction.h b/src/node/transaction.h
index 6782536ace..5f524f4e28 100644
--- a/src/node/transaction.h
+++ b/src/node/transaction.h
@@ -5,9 +5,9 @@
#ifndef BITCOIN_NODE_TRANSACTION_H
#define BITCOIN_NODE_TRANSACTION_H
+#include <common/messages.h>
#include <policy/feerate.h>
#include <primitives/transaction.h>
-#include <util/error.h>
class CBlockIndex;
class CTxMemPool;
diff --git a/src/qt/psbtoperationsdialog.cpp b/src/qt/psbtoperationsdialog.cpp
index 7bbebec46c..23bb4cc9f0 100644
--- a/src/qt/psbtoperationsdialog.cpp
+++ b/src/qt/psbtoperationsdialog.cpp
@@ -4,6 +4,7 @@
#include <qt/psbtoperationsdialog.h>
+#include <common/messages.h>
#include <core_io.h>
#include <interfaces/node.h>
#include <key_io.h>
@@ -13,7 +14,6 @@
#include <qt/forms/ui_psbtoperationsdialog.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
-#include <util/error.h>
#include <util/fs.h>
#include <util/strencodings.h>
@@ -21,6 +21,7 @@
#include <iostream>
#include <string>
+using common::TransactionErrorString;
using node::AnalyzePSBT;
using node::DEFAULT_MAX_RAW_TX_FEE_RATE;
using node::PSBTAnalysis;
diff --git a/src/rpc/fees.cpp b/src/rpc/fees.cpp
index b933d8c647..d74d77299f 100644
--- a/src/rpc/fees.cpp
+++ b/src/rpc/fees.cpp
@@ -3,6 +3,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include <common/messages.h>
#include <core_io.h>
#include <node/context.h>
#include <policy/feerate.h>
@@ -14,7 +15,6 @@
#include <rpc/util.h>
#include <txmempool.h>
#include <univalue.h>
-#include <util/fees.h>
#include <validationinterface.h>
#include <algorithm>
@@ -22,6 +22,9 @@
#include <cmath>
#include <string>
+using common::FeeModeFromString;
+using common::FeeModes;
+using common::InvalidEstimateModeErrorMessage;
using node::NodeContext;
static RPCHelpMan estimatesmartfee()
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp
index 9ae6dd98e9..f1cff640fa 100644
--- a/src/rpc/util.cpp
+++ b/src/rpc/util.cpp
@@ -7,6 +7,7 @@
#include <clientversion.h>
#include <core_io.h>
#include <common/args.h>
+#include <common/messages.h>
#include <common/types.h>
#include <consensus/amount.h>
#include <script/interpreter.h>
@@ -32,6 +33,8 @@
#include <utility>
using common::PSBTError;
+using common::PSBTErrorString;
+using common::TransactionErrorString;
const std::string UNIX_EPOCH_TIME = "UNIX epoch time";
const std::string EXAMPLE_ADDRESS[2] = {"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl", "bc1q02ad21edsxd23d32dfgqqsz4vv4nmtfzuklhy3"};
diff --git a/src/test/fuzz/fees.cpp b/src/test/fuzz/fees.cpp
index 38a8c6798e..5c760be13d 100644
--- a/src/test/fuzz/fees.cpp
+++ b/src/test/fuzz/fees.cpp
@@ -2,17 +2,19 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include <common/messages.h>
#include <consensus/amount.h>
#include <policy/fees.h>
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
-#include <util/fees.h>
#include <cstdint>
#include <string>
#include <vector>
+using common::StringForFeeReason;
+
FUZZ_TARGET(fees)
{
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
diff --git a/src/test/fuzz/kitchen_sink.cpp b/src/test/fuzz/kitchen_sink.cpp
index 42a6b316c3..3bfffba773 100644
--- a/src/test/fuzz/kitchen_sink.cpp
+++ b/src/test/fuzz/kitchen_sink.cpp
@@ -2,13 +2,13 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include <common/messages.h>
#include <merkleblock.h>
#include <policy/fees.h>
#include <rpc/util.h>
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
-#include <util/error.h>
#include <util/translation.h>
#include <array>
@@ -16,6 +16,8 @@
#include <optional>
#include <vector>
+using common::TransactionErrorString;
+
namespace {
constexpr TransactionError ALL_TRANSACTION_ERROR[] = {
TransactionError::MISSING_INPUTS,
diff --git a/src/test/fuzz/string.cpp b/src/test/fuzz/string.cpp
index 631da13803..5b1353c70b 100644
--- a/src/test/fuzz/string.cpp
+++ b/src/test/fuzz/string.cpp
@@ -5,6 +5,7 @@
#include <blockfilter.h>
#include <clientversion.h>
#include <common/args.h>
+#include <common/messages.h>
#include <common/settings.h>
#include <common/system.h>
#include <common/url.h>
@@ -21,8 +22,6 @@
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
-#include <util/error.h>
-#include <util/fees.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/translation.h>
@@ -37,6 +36,11 @@
enum class FeeEstimateMode;
+using common::AmountErrMsg;
+using common::AmountHighWarn;
+using common::FeeModeFromString;
+using common::ResolveErrMsg;
+
FUZZ_TARGET(string)
{
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
diff --git a/src/util/error.h b/src/util/error.h
deleted file mode 100644
index 5ef833b9ee..0000000000
--- a/src/util/error.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2010-2021 The Bitcoin Core developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#ifndef BITCOIN_UTIL_ERROR_H
-#define BITCOIN_UTIL_ERROR_H
-
-/**
- * util/error.h is a common place for definitions of simple error types and
- * string functions. Types and functions defined here should not require any
- * outside dependencies.
- *
- * Error types defined here can be used in different parts of the
- * codebase, to avoid the need to write boilerplate code catching and
- * translating errors passed across wallet/node/rpc/gui code boundaries.
- */
-
-#include <node/types.h>
-#include <string>
-
-struct bilingual_str;
-namespace common {
-enum class PSBTError;
-} // namespace common
-
-bilingual_str PSBTErrorString(common::PSBTError err);
-
-bilingual_str TransactionErrorString(const TransactionError error);
-
-bilingual_str ResolveErrMsg(const std::string& optname, const std::string& strBind);
-
-bilingual_str InvalidPortErrMsg(const std::string& optname, const std::string& strPort);
-
-bilingual_str AmountHighWarn(const std::string& optname);
-
-bilingual_str AmountErrMsg(const std::string& optname, const std::string& strValue);
-
-#endif // BITCOIN_UTIL_ERROR_H
diff --git a/src/util/fees.cpp b/src/util/fees.cpp
deleted file mode 100644
index 8ada02ce54..0000000000
--- a/src/util/fees.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2020 The Bitcoin Core developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#include <util/fees.h>
-
-#include <policy/fees.h>
-#include <util/strencodings.h>
-#include <util/string.h>
-
-#include <map>
-#include <string>
-#include <vector>
-#include <utility>
-
-std::string StringForFeeReason(FeeReason reason)
-{
- static const std::map<FeeReason, std::string> fee_reason_strings = {
- {FeeReason::NONE, "None"},
- {FeeReason::HALF_ESTIMATE, "Half Target 60% Threshold"},
- {FeeReason::FULL_ESTIMATE, "Target 85% Threshold"},
- {FeeReason::DOUBLE_ESTIMATE, "Double Target 95% Threshold"},
- {FeeReason::CONSERVATIVE, "Conservative Double Target longer horizon"},
- {FeeReason::MEMPOOL_MIN, "Mempool Min Fee"},
- {FeeReason::PAYTXFEE, "PayTxFee set"},
- {FeeReason::FALLBACK, "Fallback fee"},
- {FeeReason::REQUIRED, "Minimum Required Fee"},
- };
- auto reason_string = fee_reason_strings.find(reason);
-
- if (reason_string == fee_reason_strings.end()) return "Unknown";
-
- return reason_string->second;
-}
-
-const std::vector<std::pair<std::string, FeeEstimateMode>>& FeeModeMap()
-{
- static const std::vector<std::pair<std::string, FeeEstimateMode>> FEE_MODES = {
- {"unset", FeeEstimateMode::UNSET},
- {"economical", FeeEstimateMode::ECONOMICAL},
- {"conservative", FeeEstimateMode::CONSERVATIVE},
- };
- return FEE_MODES;
-}
-
-std::string FeeModes(const std::string& delimiter)
-{
- return Join(FeeModeMap(), delimiter, [&](const std::pair<std::string, FeeEstimateMode>& i) { return i.first; });
-}
-
-std::string InvalidEstimateModeErrorMessage()
-{
- return "Invalid estimate_mode parameter, must be one of: \"" + FeeModes("\", \"") + "\"";
-}
-
-bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_estimate_mode)
-{
- auto searchkey = ToUpper(mode_string);
- for (const auto& pair : FeeModeMap()) {
- if (ToUpper(pair.first) == searchkey) {
- fee_estimate_mode = pair.second;
- return true;
- }
- }
- return false;
-}
diff --git a/src/util/fees.h b/src/util/fees.h
deleted file mode 100644
index 10ba1e4f85..0000000000
--- a/src/util/fees.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2020 The Bitcoin Core developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#ifndef BITCOIN_UTIL_FEES_H
-#define BITCOIN_UTIL_FEES_H
-
-#include <string>
-
-enum class FeeEstimateMode;
-enum class FeeReason;
-
-bool FeeModeFromString(const std::string& mode_string, FeeEstimateMode& fee_estimate_mode);
-std::string StringForFeeReason(FeeReason reason);
-std::string FeeModes(const std::string& delimiter);
-std::string InvalidEstimateModeErrorMessage();
-
-#endif // BITCOIN_UTIL_FEES_H
diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp
index 12c59acadf..1143a79020 100644
--- a/src/wallet/rpc/spend.cpp
+++ b/src/wallet/rpc/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 <common/messages.h>
#include <consensus/validation.h>
#include <core_io.h>
#include <key_io.h>
@@ -9,7 +10,6 @@
#include <rpc/rawtransaction_util.h>
#include <rpc/util.h>
#include <script/script.h>
-#include <util/fees.h>
#include <util/rbf.h>
#include <util/translation.h>
#include <util/vector.h>
@@ -22,6 +22,11 @@
#include <univalue.h>
+using common::FeeModeFromString;
+using common::FeeModes;
+using common::InvalidEstimateModeErrorMessage;
+using common::StringForFeeReason;
+using common::TransactionErrorString;
namespace wallet {
std::vector<CRecipient> CreateRecipients(const std::vector<std::pair<CTxDestination, CAmount>>& outputs, const std::set<int>& subtract_fee_outputs)
diff --git a/src/wallet/scriptpubkeyman.h b/src/wallet/scriptpubkeyman.h
index 470a73e6b3..5f8a32acc8 100644
--- a/src/wallet/scriptpubkeyman.h
+++ b/src/wallet/scriptpubkeyman.h
@@ -6,6 +6,7 @@
#define BITCOIN_WALLET_SCRIPTPUBKEYMAN_H
#include <addresstype.h>
+#include <common/messages.h>
#include <common/signmessage.h>
#include <common/types.h>
#include <logging.h>
@@ -13,7 +14,6 @@
#include <script/descriptor.h>
#include <script/script.h>
#include <script/signingprovider.h>
-#include <util/error.h>
#include <util/result.h>
#include <util/time.h>
#include <wallet/crypter.h>
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
index 9a7e166e68..c47c9188cd 100644
--- a/src/wallet/spend.cpp
+++ b/src/wallet/spend.cpp
@@ -4,6 +4,7 @@
#include <algorithm>
#include <common/args.h>
+#include <common/messages.h>
#include <common/system.h>
#include <consensus/amount.h>
#include <consensus/validation.h>
@@ -15,7 +16,6 @@
#include <script/signingprovider.h>
#include <script/solver.h>
#include <util/check.h>
-#include <util/fees.h>
#include <util/moneystr.h>
#include <util/rbf.h>
#include <util/trace.h>
@@ -29,6 +29,8 @@
#include <cmath>
+using common::StringForFeeReason;
+using common::TransactionErrorString;
using interfaces::FoundBlock;
namespace wallet {
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index f0c320fcff..429c986e0c 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -11,6 +11,7 @@
#include <chain.h>
#include <coins.h>
#include <common/args.h>
+#include <common/messages.h>
#include <common/settings.h>
#include <common/signmessage.h>
#include <common/system.h>
@@ -50,7 +51,6 @@
#include <uint256.h>
#include <univalue.h>
#include <util/check.h>
-#include <util/error.h>
#include <util/fs.h>
#include <util/fs_helpers.h>
#include <util/moneystr.h>
@@ -81,6 +81,8 @@
struct KeyOriginInfo;
+using common::AmountErrMsg;
+using common::AmountHighWarn;
using common::PSBTError;
using interfaces::FoundBlock;