Skip to content

Commit 65cfaea

Browse files
committed
refactor: add src/node/context.* to node:: namespace
Split out as a separate commit as NodeContext is more pervasively used in Dash-specific code
1 parent e89e8a7 commit 65cfaea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+154
-60
lines changed

src/bench/coin_selection.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
#include <set>
1313

14+
using node::NodeContext;
15+
1416
static void addCoin(const CAmount& nValue, const CWallet& wallet, std::vector<std::unique_ptr<CWalletTx>>& wtxs)
1517
{
1618
static int nextLockTime = 0;

src/bitcoind.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include <cstdio>
3232
#include <functional>
3333

34+
using node::NodeContext;
35+
3436
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
3537
UrlDecodeFn* const URL_DECODE = urlDecode;
3638

src/coinjoin/interfaces.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <memory>
1818
#include <string>
1919

20+
using node::NodeContext;
21+
2022
namespace coinjoin {
2123
namespace {
2224

src/context.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ class ChainstateManager;
1313
class CTxMemPool;
1414
class CBlockPolicyEstimator;
1515
struct LLMQContext;
16-
struct NodeContext;
1716
struct WalletContext;
17+
namespace node {
18+
struct NodeContext;
19+
} // namespace node
1820

1921
using CoreContext = std::variant<std::monostate,
2022
std::reference_wrapper<ArgsManager>,
21-
std::reference_wrapper<NodeContext>,
23+
std::reference_wrapper<node::NodeContext>,
2224
std::reference_wrapper<WalletContext>,
2325
std::reference_wrapper<CTxMemPool>,
2426
std::reference_wrapper<ChainstateManager>,

src/init.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@
134134
#include <zmq/zmqrpc.h>
135135
#endif
136136

137+
using node::NodeContext;
138+
137139
static constexpr bool DEFAULT_PROXYRANDOMIZE{true};
138140
static constexpr bool DEFAULT_REST_ENABLE{false};
139141
static constexpr bool DEFAULT_I2P_ACCEPT_INCOMING{true};

src/init.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ static constexpr bool DEFAULT_DAEMON = false;
1717
static constexpr bool DEFAULT_DAEMONWAIT = false;
1818

1919
class ArgsManager;
20-
struct NodeContext;
2120
namespace interfaces {
2221
struct BlockAndHeaderTipInfo;
2322
} // namespace interfaces
23+
namespace node {
24+
struct NodeContext;
25+
} // namespace node
2426

2527
/** Interrupt threads */
26-
void Interrupt(NodeContext& node);
27-
void Shutdown(NodeContext& node);
28+
void Interrupt(node::NodeContext& node);
29+
void Shutdown(node::NodeContext& node);
2830
//!Initialize the logging infrastructure
2931
void InitLogging(const ArgsManager& args);
3032
//!Parameter interaction: change current parameters depending on various rules
@@ -56,14 +58,14 @@ bool AppInitLockDataDirectory();
5658
/**
5759
* Initialize node and wallet interface pointers. Has no prerequisites or side effects besides allocating memory.
5860
*/
59-
bool AppInitInterfaces(NodeContext& node);
61+
bool AppInitInterfaces(node::NodeContext& node);
6062
/**
6163
* Dash Core main initialization.
6264
* @note This should only be done after daemonization. Call Shutdown() if this function fails.
6365
* @pre Parameters should be parsed and config file should be read, AppInitLockDataDirectory should have been called.
6466
*/
65-
bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info = nullptr);
66-
void PrepareShutdown(NodeContext& node);
67+
bool AppInitMain(node::NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info = nullptr);
68+
void PrepareShutdown(node::NodeContext& node);
6769

6870
/**
6971
* Register all arguments with the ArgsManager

src/init/bitcoin-node.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const char* EXE_NAME = "dash-node";
2222
class BitcoinNodeInit : public interfaces::Init
2323
{
2424
public:
25-
BitcoinNodeInit(NodeContext& node, const char* arg0)
25+
BitcoinNodeInit(node::NodeContext& node, const char* arg0)
2626
: m_node(node),
2727
m_ipc(interfaces::MakeIpc(EXE_NAME, arg0, *this))
2828
{
@@ -41,14 +41,14 @@ class BitcoinNodeInit : public interfaces::Init
4141
}
4242
std::unique_ptr<interfaces::Echo> makeEcho() override { return interfaces::MakeEcho(); }
4343
interfaces::Ipc* ipc() override { return m_ipc.get(); }
44-
NodeContext& m_node;
44+
node::NodeContext& m_node;
4545
std::unique_ptr<interfaces::Ipc> m_ipc;
4646
};
4747
} // namespace
4848
} // namespace init
4949

5050
namespace interfaces {
51-
std::unique_ptr<Init> MakeNodeInit(NodeContext& node, int argc, char* argv[], int& exit_status)
51+
std::unique_ptr<Init> MakeNodeInit(node::NodeContext& node, int argc, char* argv[], int& exit_status)
5252
{
5353
auto init = std::make_unique<init::BitcoinNodeInit>(node, argc > 0 ? argv[0] : "");
5454
// Check if bitcoin-node is being invoked as an IPC server. If so, then

src/init/bitcoind.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#include <memory>
1616

17+
using node::NodeContext;
18+
1719
namespace init {
1820
namespace {
1921
class BitcoindInit : public interfaces::Init

src/interfaces/chain.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ enum class MemPoolRemovalReason;
3131
struct bilingual_str;
3232
struct CBlockLocator;
3333
struct FeeCalculation;
34+
namespace node {
3435
struct NodeContext;
35-
enum class MemPoolRemovalReason;
36-
36+
} // namespace node
3737
namespace llmq {
3838
class CChainLockSig;
3939
struct CInstantSendLock;
@@ -339,7 +339,7 @@ class ChainClient
339339
};
340340

341341
//! Return implementation of Chain interface.
342-
std::unique_ptr<Chain> MakeChain(NodeContext& node);
342+
std::unique_ptr<Chain> MakeChain(node::NodeContext& node);
343343

344344
} // namespace interfaces
345345

src/interfaces/coinjoin.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
#include <vector>
1111

1212
class CWallet;
13+
namespace node {
1314
struct NodeContext;
15+
} // namespace node
1416

1517
class UniValue;
1618

@@ -46,7 +48,7 @@ class Loader
4648
};
4749
} // namespace CoinJoin
4850

49-
std::unique_ptr<CoinJoin::Loader> MakeCoinJoinLoader(NodeContext& node);
51+
std::unique_ptr<CoinJoin::Loader> MakeCoinJoinLoader(node::NodeContext& node);
5052

5153
} // namespace interfaces
5254

0 commit comments

Comments
 (0)