Skip to content

Commit 4d05d3f

Browse files
committed
util: add TransactionError includes and namespace declarations
Add TransactionError to node namespace and include it directly instead of relying on indirect include through common/messages.h This is a followup to a previous commit which moved the TransactionError enum. These changes were done in a separate followup just to keep the previous commit more minimal and easy to review.
1 parent 680eafd commit 4d05d3f

26 files changed

+48
-8
lines changed

src/common/messages.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <common/types.h>
99
#include <policy/fees.h>
10+
#include <node/types.h>
1011
#include <tinyformat.h>
1112
#include <util/strencodings.h>
1213
#include <util/string.h>
@@ -18,6 +19,8 @@
1819
#include <utility>
1920
#include <vector>
2021

22+
using node::TransactionError;
23+
2124
namespace common {
2225
std::string StringForFeeReason(FeeReason reason)
2326
{

src/common/messages.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
#ifndef BITCOIN_COMMON_MESSAGES_H
1212
#define BITCOIN_COMMON_MESSAGES_H
1313

14-
#include <node/types.h>
1514
#include <string>
1615

1716
struct bilingual_str;
1817

1918
enum class FeeEstimateMode;
2019
enum class FeeReason;
20+
namespace node {
21+
enum class TransactionError;
22+
} // namespace node
2123

2224
namespace common {
2325
enum class PSBTError;
@@ -26,7 +28,7 @@ std::string StringForFeeReason(FeeReason reason);
2628
std::string FeeModes(const std::string& delimiter);
2729
std::string InvalidEstimateModeErrorMessage();
2830
bilingual_str PSBTErrorString(PSBTError error);
29-
bilingual_str TransactionErrorString(const TransactionError error);
31+
bilingual_str TransactionErrorString(const node::TransactionError error);
3032
bilingual_str ResolveErrMsg(const std::string& optname, const std::string& strBind);
3133
bilingual_str InvalidPortErrMsg(const std::string& optname, const std::string& strPort);
3234
bilingual_str AmountHighWarn(const std::string& optname);

src/interfaces/node.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ class RPCTimerInterface;
3030
class UniValue;
3131
class Proxy;
3232
enum class SynchronizationState;
33-
enum class TransactionError;
3433
struct CNodeStateStats;
3534
struct bilingual_str;
3635
namespace node {
36+
enum class TransactionError;
3737
struct NodeContext;
3838
} // namespace node
3939
namespace wallet {
@@ -208,7 +208,7 @@ class Node
208208
virtual std::optional<Coin> getUnspentOutput(const COutPoint& output) = 0;
209209

210210
//! Broadcast transaction.
211-
virtual TransactionError broadcastTransaction(CTransactionRef tx, CAmount max_tx_fee, std::string& err_string) = 0;
211+
virtual node::TransactionError broadcastTransaction(CTransactionRef tx, CAmount max_tx_fee, std::string& err_string) = 0;
212212

213213
//! Get wallet loader.
214214
virtual WalletLoader& walletLoader() = 0;

src/interfaces/wallet.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ struct bilingual_str;
3535
namespace common {
3636
enum class PSBTError;
3737
} // namespace common
38+
namespace node {
39+
enum class TransactionError;
40+
} // namespace node
3841
namespace wallet {
3942
class CCoinControl;
4043
class CWallet;

src/node/interfaces.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <node/interface_ui.h>
3232
#include <node/mini_miner.h>
3333
#include <node/transaction.h>
34+
#include <node/types.h>
3435
#include <policy/feerate.h>
3536
#include <policy/fees.h>
3637
#include <policy/policy.h>

src/node/transaction.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <net_processing.h>
1010
#include <node/blockstorage.h>
1111
#include <node/context.h>
12+
#include <node/types.h>
1213
#include <txmempool.h>
1314
#include <validation.h>
1415
#include <validationinterface.h>

src/node/types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#ifndef BITCOIN_NODE_TYPES_H
1414
#define BITCOIN_NODE_TYPES_H
1515

16+
namespace node {
1617
enum class TransactionError {
1718
OK, //!< No error
1819
MISSING_INPUTS,
@@ -23,5 +24,6 @@ enum class TransactionError {
2324
MAX_BURN_EXCEEDED,
2425
INVALID_PACKAGE,
2526
};
27+
} // namespace node
2628

2729
#endif // BITCOIN_NODE_TYPES_H

src/psbt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
#include <psbt.h>
66

7+
#include <node/types.h>
78
#include <policy/policy.h>
89
#include <script/signingprovider.h>
910
#include <util/check.h>
1011
#include <util/strencodings.h>
1112

12-
1313
PartiallySignedTransaction::PartiallySignedTransaction(const CMutableTransaction& tx) : tx(tx)
1414
{
1515
inputs.resize(tx.vin.size());

src/psbt.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
#include <optional>
1919

20+
namespace node {
21+
enum class TransactionError;
22+
} // namespace node
23+
2024
// Magic bytes
2125
static constexpr uint8_t PSBT_MAGIC_BYTES[5] = {'p', 's', 'b', 't', 0xff};
2226

src/qt/psbtoperationsdialog.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <interfaces/node.h>
1010
#include <key_io.h>
1111
#include <node/psbt.h>
12+
#include <node/types.h>
1213
#include <policy/policy.h>
1314
#include <qt/bitcoinunits.h>
1415
#include <qt/forms/ui_psbtoperationsdialog.h>
@@ -25,6 +26,7 @@ using common::TransactionErrorString;
2526
using node::AnalyzePSBT;
2627
using node::DEFAULT_MAX_RAW_TX_FEE_RATE;
2728
using node::PSBTAnalysis;
29+
using node::TransactionError;
2830

2931
PSBTOperationsDialog::PSBTOperationsDialog(
3032
QWidget* parent, WalletModel* wallet_model, ClientModel* client_model) : QDialog(parent, GUIUtil::dialog_flags),

0 commit comments

Comments
 (0)