Skip to content

Commit a73024d

Browse files
Merge #6594: refactor: polish CoinJoin interface, use WalletLoader in Dash wallet initialization code, introduce new RPC coinjoin status
68cec8d refactor: use `interfaces::WalletLoader` in Dash-specific wallet init (Kittywhiskers Van Gogh) c9c5275 refactor: get rid of `DashPostChainstateSetup()` (Kittywhiskers Van Gogh) 6502e54 refactor: use `CoinJoin::Loader` in `InitCoinJoinSettings` (Kittywhiskers Van Gogh) 0d8de73 refactor: make `WalletContext::coinjoin_loader` a pointer (Kittywhiskers Van Gogh) 0760ae0 fix: resolve undefined reference linking error in `bench_dash` (Kittywhiskers Van Gogh) 846dc67 refactor: initialize CoinJoin loader in `WalletInit::Construct()` (Kittywhiskers Van Gogh) b14e55f chore: fix `MakeWallet` argument list in dummy wallet (Kittywhiskers Van Gogh) b3ac5cf refactor: place `ArgsManager` before `interfaces::CoinJoin::Loader` (Kittywhiskers Van Gogh) 73671dd refactor: fold `InitCoinJoinSettings` calls into `CoinJoin::Loader` (Kittywhiskers Van Gogh) 27f8d9c refactor: defer accessing `CoinJoinWalletManager` to interface call (Kittywhiskers Van Gogh) 398e9c3 refactor: stop exposing `CoinJoinWalletManager` from `CoinJoin::Loader` (Kittywhiskers Van Gogh) 48fccdd refactor: introduce `coinjoin status` for information on mix sessions (Kittywhiskers Van Gogh) Pull request description: ## Motivation Since [bitcoin#22219](bitcoin#22219) (introduced in [dash#6568](#6568)), the workarounds implemented for allowing the backport of [bitcoin#19101](bitcoin#19101) (a part of [dash#6529](#6529)) no longer work. A major reason for this is the initialization order assumed in [dash#6529](#6529) is no longer holds true, requiring a rework of CoinJoin interfaces. This pull request aims to do that. ## Additional Information * Dependency for #6529 * To allow for dropping `walletman()` from `CoinJoin::Loader`, both `CoinJoin::Loader` and `CoinJoin::Client` (accessible through `CoinJoin::Loader::GetClient()`) need to account for all potential usage. To that end, `CoinJoin::Client::get{JsonInfo, SessionStatuses}()` have been implemented. * Though some invocations of `CCoinJoinClientSession` functions cannot (or rather, should not) be available through the interface (like `DoAutomaticDenominating()`). * To take care of one such invocation (in `coinjoin start`, [source](https://github.com/dashpay/dash/blob/5c1a6270a73ea7025879ee0485be5095b3bc142b/src/rpc/coinjoin.cpp#L135-L136)), it has been removed altogether. `coinjoin start` will now behave like the "Start CoinJoin" button in Dash Qt and won't try to get ahead of the scheduler and start denomination. * The loss of status information in fail cases due to this, has been made up for with a new RPC, `coinjoin status`, that will report status information during any active mix session (as opposed to earlier behavior where such information was only made available when starting a mix session through `coinjoin start` and encountering a fail state). * `CoinJoin::Loader` and `WalletLoader` rely on each other as * `CoinJoin::Loader::{Add,Remove}Wallet()` needs to be able to run `WalletInitInterface::InitCoinJoinSettings()`, which in turn needs to be able enumerate through all available wallets ([source](https://github.com/dashpay/dash/blob/5c1a6270a73ea7025879ee0485be5095b3bc142b/src/wallet/init.cpp#L207)), currently doing so through the global wallet context but eventually through `WalletLoader` when said globals are no longer available (post-[bitcoin#19101](bitcoin#19101)) * `WalletLoader` needs `CoinJoin::Loader` to load ([source](https://github.com/dashpay/dash/blob/5c1a6270a73ea7025879ee0485be5095b3bc142b/src/wallet/interfaces.cpp#601)) and restore ([source](https://github.com/dashpay/dash/blob/5c1a6270a73ea7025879ee0485be5095b3bc142b/src/wallet/interfaces.cpp#L607)) wallets as `CWallet` needs access to `CoinJoin::Loader` in order to call `CoinJoin::Loader::{Add,Remove}Wallet()` ([source](https://github.com/dashpay/dash/blob/5c1a6270a73ea7025879ee0485be5095b3bc142b/src/wallet/wallet.cpp#L3516), [source](https://github.com/dashpay/dash/blob/5c1a6270a73ea7025879ee0485be5095b3bc142b/src/wallet/wallet.cpp#L148)) This interdependent relationship has currently been floating along by passing a const ref of the smart pointer ([source](https://github.com/dashpay/dash/blob/5c1a6270a73ea7025879ee0485be5095b3bc142b/src/interfaces/init.h#L37)), which makes for cumbersome but workable code but in combination with [bitcoin#22219](bitcoin#22219), it breaks [bitcoin#19101](bitcoin#19101) as it forces us to definitively initialize both `WalletLoader` and `CoinJoin::Loader` _before_ we get to initialize CoinJoin logic. To work around this, instead of requiring a fully initialized `CoinJoinWalletManager` to create a `CoinJoin::Loader`, we instead take `NodeContext` and defer resolving `CoinJoinWalletManager` to when interface calls are made. * By moving the initialization of the CoinJoin loader from `AppInitMain()` to `WalletInit::Construct()`, the linker was unhappy with trying to emit `bench_dash` (see error below). This was remedied by linking `libbitcoin_wallet` with `libtest_util`. <details> <summary>Linker error:</summary> ``` AR libbitcoin_server.a CXXLD dashd CXXLD test/test_dash CXXLD bench/bench_dash CXXLD qt/dash-qt CXXLD qt/test/test_dash-qt /usr/bin/ld: libtest_util.a(libtest_util_a-setup_common.o): in function `DashPostChainstateSetup(NodeContext&)': /src/dash/src/test/util/setup_common.cpp:127:(.text+0x1a8e): undefined reference to `interfaces::MakeCoinJoinLoader(NodeContext&)' collect2: error: ld returned 1 exit status make[2]: *** [Makefile:7354: bench/bench_dash] Error 1 make[2]: *** Waiting for unfinished jobs.... make[2]: Leaving directory '/src/dash/src' make[1]: *** [Makefile:20648: all-recursive] Error 1 make[1]: Leaving directory '/src/dash/src' make: *** [Makefile:797: all-recursive] Error 1 ``` </details> * [bitcoin#22219](bitcoin#22219) removes a `WalletInit::Construct()` call from `setup_common.cpp` ([source](029572d#diff-6a8ef76c60f30a6ca67d9f0e478fd02989c4b7fbc4c3116f80e13d873d5775e6L195-L198)), which is necessary since `WalletInit::Construct()` now relies on `node.init` ([source](https://github.com/dashpay/dash/blob/5c1a6270a73ea7025879ee0485be5095b3bc142b/src/wallet/init.cpp#L191)). This isn't so much a problem for tests that use `WalletTestingSetup` or `InitWalletDirTestingSetup` but creates problems for tests based on `TestChain100Setup` ([source](https://github.com/dashpay/dash/blob/5c1a6270a73ea7025879ee0485be5095b3bc142b/src/wallet/test/coinjoin_tests.cpp#L128), [source](https://github.com/dashpay/dash/blob/5c1a6270a73ea7025879ee0485be5095b3bc142b/src/wallet/test/wallet_tests.cpp#L205)), which is a specialization of `TestingSetup` that in turn, used to initialize `coinjoin_loader` ([source](https://github.com/dashpay/dash/blob/5c1a6270a73ea7025879ee0485be5095b3bc142b/src/test/util/setup_common.cpp#L127)) but since initialization has been moved to `WalletInit::Construct()` in line with `Init::makeWalletLoader()`, it is not done automatically anymore. To work around this, `WalletInit::Construct()`-like code has been introduced to initialize both `coinjoin_loader` and `wallet_loader` ([source](https://github.com/kwvg/dash/blob/038619d284c457610ebbf833991298469c3e9a3d/src/test/util/setup_common.cpp#L320-L329)). ## Breaking Changes * `coinjoin start` will no longer report errors from mix sessions. To see the status of mix sessions, a new RPC, `coinjoin status`, is available in its place. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 68cec8d PastaPastaPasta: utACK 68cec8d Tree-SHA512: 17ffc8f79ff19ffee9874787bf9cf982c8059c566475ed78634c3870506a24020f969c35ed6d23748fea0f993d9e646929d523c9c441fad27ea5eaf4b9438303
2 parents b4e2269 + 68cec8d commit a73024d

30 files changed

+249
-150
lines changed

doc/release-notes-6594.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Updated RPCs
2+
------------
3+
4+
* `coinjoin status` is a new RPC that reports the status message of all running mix
5+
sessions.
6+
* `coinjoin start` will no longer report errors from mix sessions, users are recommended
7+
to query the status of mix sessions using `coinjoin status` instead.

src/Makefile.test_util.include

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ LIBTEST_UTIL += $(LIBBITCOIN_SERVER)
4343
LIBTEST_UTIL += $(LIBBITCOIN_COMMON)
4444
LIBTEST_UTIL += $(LIBBITCOIN_UTIL)
4545
LIBTEST_UTIL += $(LIBBITCOIN_CRYPTO_BASE)
46+
if ENABLE_WALLET
47+
LIBTEST_UTIL += $(LIBBITCOIN_WALLET)
48+
endif

src/coinjoin/client.cpp

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -350,17 +350,18 @@ bilingual_str CCoinJoinClientSession::GetStatus(bool fWaitForBlock) const
350350
}
351351
}
352352

353-
bilingual_str CCoinJoinClientManager::GetStatuses()
353+
std::vector<std::string> CCoinJoinClientManager::GetStatuses() const
354354
{
355-
bilingual_str strStatus;
356-
bool fWaitForBlock = WaitForAnotherBlock();
357-
358355
AssertLockNotHeld(cs_deqsessions);
356+
357+
bool fWaitForBlock{WaitForAnotherBlock()};
358+
std::vector<std::string> ret;
359+
359360
LOCK(cs_deqsessions);
360361
for (const auto& session : deqSessions) {
361-
strStatus = strStatus + session.GetStatus(fWaitForBlock) + Untranslated("; ");
362+
ret.push_back(session.GetStatus(fWaitForBlock).original);
362363
}
363-
return strStatus;
364+
return ret;
364365
}
365366

366367
std::string CCoinJoinClientManager::GetSessionDenoms()
@@ -1914,14 +1915,11 @@ void CCoinJoinClientManager::GetJsonInfo(UniValue& obj) const
19141915

19151916
void CoinJoinWalletManager::Add(const std::shared_ptr<CWallet>& wallet)
19161917
{
1917-
{
1918-
LOCK(cs_wallet_manager_map);
1919-
m_wallet_manager_map.try_emplace(wallet->GetName(),
1920-
std::make_unique<CCoinJoinClientManager>(wallet, *this, m_dmnman, m_mn_metaman,
1921-
m_mn_sync, m_isman, m_queueman,
1922-
m_is_masternode));
1923-
}
1924-
g_wallet_init_interface.InitCoinJoinSettings(*this);
1918+
LOCK(cs_wallet_manager_map);
1919+
m_wallet_manager_map.try_emplace(wallet->GetName(),
1920+
std::make_unique<CCoinJoinClientManager>(wallet, *this, m_dmnman, m_mn_metaman,
1921+
m_mn_sync, m_isman, m_queueman,
1922+
m_is_masternode));
19251923
}
19261924

19271925
void CoinJoinWalletManager::DoMaintenance(CConnman& connman)
@@ -1933,11 +1931,8 @@ void CoinJoinWalletManager::DoMaintenance(CConnman& connman)
19331931
}
19341932

19351933
void CoinJoinWalletManager::Remove(const std::string& name) {
1936-
{
1937-
LOCK(cs_wallet_manager_map);
1938-
m_wallet_manager_map.erase(name);
1939-
}
1940-
g_wallet_init_interface.InitCoinJoinSettings(*this);
1934+
LOCK(cs_wallet_manager_map);
1935+
m_wallet_manager_map.erase(name);
19411936
}
19421937

19431938
void CoinJoinWalletManager::Flush(const std::string& name)

src/coinjoin/client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ class CCoinJoinClientManager
327327
bool IsMixing() const;
328328
void ResetPool() EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
329329

330-
bilingual_str GetStatuses() EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
330+
std::vector<std::string> GetStatuses() const EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
331331
std::string GetSessionDenoms() EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);
332332

333333
bool GetMixingMasternodesInfo(std::vector<CDeterministicMNCPtr>& vecDmnsRet) const EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions);

src/coinjoin/interfaces.cpp

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
#include <interfaces/coinjoin.h>
66

77
#include <coinjoin/client.h>
8+
#include <coinjoin/context.h>
9+
#include <coinjoin/options.h>
10+
#include <node/context.h>
11+
#include <util/check.h>
812
#include <wallet/wallet.h>
13+
#include <walletinitinterface.h>
14+
15+
#include <univalue.h>
916

1017
#include <memory>
1118
#include <string>
@@ -37,10 +44,18 @@ class CoinJoinClientImpl : public interfaces::CoinJoin::Client
3744
{
3845
return m_clientman.nCachedNumBlocks;
3946
}
47+
void getJsonInfo(UniValue& obj) override
48+
{
49+
return m_clientman.GetJsonInfo(obj);
50+
}
4051
std::string getSessionDenoms() override
4152
{
4253
return m_clientman.GetSessionDenoms();
4354
}
55+
std::vector<std::string> getSessionStatuses() override
56+
{
57+
return m_clientman.GetStatuses();
58+
}
4459
void setCachedBlocks(int nCachedBlocks) override
4560
{
4661
m_clientman.nCachedNumBlocks = nCachedBlocks;
@@ -61,35 +76,51 @@ class CoinJoinClientImpl : public interfaces::CoinJoin::Client
6176

6277
class CoinJoinLoaderImpl : public interfaces::CoinJoin::Loader
6378
{
64-
CoinJoinWalletManager& m_walletman;
79+
private:
80+
CoinJoinWalletManager& walletman()
81+
{
82+
return *Assert(Assert(m_node.cj_ctx)->walletman);
83+
}
84+
85+
interfaces::WalletLoader& wallet_loader()
86+
{
87+
return *Assert(m_node.wallet_loader);
88+
}
6589

6690
public:
67-
explicit CoinJoinLoaderImpl(CoinJoinWalletManager& walletman)
68-
: m_walletman(walletman) {}
91+
explicit CoinJoinLoaderImpl(NodeContext& node) :
92+
m_node(node)
93+
{
94+
// Enablement will be re-evaluated when a wallet is added or removed
95+
CCoinJoinClientOptions::SetEnabled(false);
96+
}
6997

70-
void AddWallet(const std::shared_ptr<CWallet>& wallet) override { m_walletman.Add(wallet); }
98+
void AddWallet(const std::shared_ptr<CWallet>& wallet) override
99+
{
100+
walletman().Add(wallet);
101+
g_wallet_init_interface.InitCoinJoinSettings(*this, wallet_loader());
102+
}
71103
void RemoveWallet(const std::string& name) override
72104
{
73-
m_walletman.Remove(name);
105+
walletman().Remove(name);
106+
g_wallet_init_interface.InitCoinJoinSettings(*this, wallet_loader());
74107
}
75108
void FlushWallet(const std::string& name) override
76109
{
77-
m_walletman.Flush(name);
110+
walletman().Flush(name);
78111
}
79112
std::unique_ptr<interfaces::CoinJoin::Client> GetClient(const std::string& name) override
80113
{
81-
auto clientman = m_walletman.Get(name);
114+
auto clientman = walletman().Get(name);
82115
return clientman ? std::make_unique<CoinJoinClientImpl>(*clientman) : nullptr;
83116
}
84-
CoinJoinWalletManager& walletman() override
85-
{
86-
return m_walletman;
87-
}
117+
118+
NodeContext& m_node;
88119
};
89120

90121
} // namespace
91122
} // namespace coinjoin
92123

93124
namespace interfaces {
94-
std::unique_ptr<CoinJoin::Loader> MakeCoinJoinLoader(CoinJoinWalletManager& walletman) { return std::make_unique<coinjoin::CoinJoinLoaderImpl>(walletman); }
125+
std::unique_ptr<CoinJoin::Loader> MakeCoinJoinLoader(NodeContext& node) { return std::make_unique<coinjoin::CoinJoinLoaderImpl>(node); }
95126
} // namespace interfaces

src/dummywallet.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class Chain;
1414
class Handler;
1515
class Wallet;
1616
class WalletClient;
17+
class WalletLoader;
1718
namespace CoinJoin {
1819
class Loader;
1920
} // namespcae CoinJoin
@@ -28,8 +29,8 @@ class DummyWalletInit : public WalletInitInterface {
2829
void Construct(NodeContext& node) const override {LogPrintf("No wallet support compiled in!\n");}
2930

3031
// Dash Specific WalletInitInterface InitCoinJoinSettings
31-
void AutoLockMasternodeCollaterals() const override {}
32-
void InitCoinJoinSettings(const CoinJoinWalletManager& cjwalletman) const override {}
32+
void AutoLockMasternodeCollaterals(interfaces::WalletLoader& wallet_loader) const override {}
33+
void InitCoinJoinSettings(interfaces::CoinJoin::Loader& coinjoin_loader, interfaces::WalletLoader& wallet_loader) const override {}
3334
bool InitAutoBackup() const override {return true;}
3435
};
3536

@@ -80,12 +81,17 @@ const WalletInitInterface& g_wallet_init_interface = DummyWalletInit();
8081

8182
namespace interfaces {
8283

83-
std::unique_ptr<Wallet> MakeWallet(const std::shared_ptr<CWallet>& wallet, const CoinJoinWalletManager& cjwalletman)
84+
std::unique_ptr<CoinJoin::Loader> MakeCoinJoinLoader(NodeContext& node)
8485
{
8586
throw std::logic_error("Wallet function called in non-wallet build.");
8687
}
8788

88-
std::unique_ptr<WalletClient> MakeWalletLoader(Chain& chain, const std::unique_ptr<interfaces::CoinJoin::Loader>& coinjoin_loader, ArgsManager& args)
89+
std::unique_ptr<Wallet> MakeWallet(const std::shared_ptr<CWallet>& wallet)
90+
{
91+
throw std::logic_error("Wallet function called in non-wallet build.");
92+
}
93+
94+
std::unique_ptr<WalletClient> MakeWalletLoader(Chain& chain, ArgsManager& args, interfaces::CoinJoin::Loader& coinjoin_loader)
8995
{
9096
throw std::logic_error("Wallet function called in non-wallet build.");
9197
}

src/init.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,11 +2028,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
20282028
node.mn_activeman.get(), *node.mn_sync, *node.llmq_ctx->isman, node.peerman,
20292029
!ignores_incoming_txs);
20302030

2031-
#ifdef ENABLE_WALLET
2032-
node.coinjoin_loader = interfaces::MakeCoinJoinLoader(*node.cj_ctx->walletman);
2033-
g_wallet_init_interface.InitCoinJoinSettings(*node.cj_ctx->walletman);
2034-
#endif // ENABLE_WALLET
2035-
20362031
// ********************************************************* Step 7d: Setup other Dash services
20372032

20382033
bool fLoadCacheFiles = !(fReindex || fReindexChainState) && (chainman.ActiveChain().Tip() != nullptr);
@@ -2207,6 +2202,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
22072202
chainman.m_load_block = std::thread(&util::TraceThread, "loadblk", [=, &args, &chainman, &node] {
22082203
ThreadImport(chainman, *node.dmnman, *g_ds_notification_interface, vImportFiles, node.mn_activeman.get(), args);
22092204
});
2205+
#ifdef ENABLE_WALLET
2206+
if (!args.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) {
2207+
g_wallet_init_interface.AutoLockMasternodeCollaterals(*node.wallet_loader);
2208+
}
2209+
#endif // ENABLE_WALLET
22102210

22112211
// Wait for genesis block to be processed
22122212
{

src/init/bitcoin-node.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include <interfaces/chain.h>
6+
#include <interfaces/coinjoin.h>
67
#include <interfaces/echo.h>
78
#include <interfaces/init.h>
89
#include <interfaces/ipc.h>
910
#include <interfaces/node.h>
1011
#include <interfaces/wallet.h>
1112
#include <node/context.h>
13+
#include <util/check.h>
1214
#include <util/system.h>
1315

1416
#include <memory>
@@ -29,9 +31,13 @@ class BitcoinNodeInit : public interfaces::Init
2931
}
3032
std::unique_ptr<interfaces::Node> makeNode() override { return interfaces::MakeNode(m_node); }
3133
std::unique_ptr<interfaces::Chain> makeChain() override { return interfaces::MakeChain(m_node); }
32-
std::unique_ptr<interfaces::WalletLoader> makeWalletLoader(interfaces::Chain& chain, const std::unique_ptr<interfaces::CoinJoin::Loader>& loader) override
34+
std::unique_ptr<interfaces::CoinJoin::Loader> makeCoinJoinLoader() override
3335
{
34-
return MakeWalletLoader(chain, loader, *Assert(m_node.args));
36+
return interfaces::MakeCoinJoinLoader(m_node);
37+
}
38+
std::unique_ptr<interfaces::WalletLoader> makeWalletLoader(interfaces::Chain& chain, interfaces::CoinJoin::Loader& coinjoin_loader) override
39+
{
40+
return MakeWalletLoader(chain, *Assert(m_node.args), coinjoin_loader);
3541
}
3642
std::unique_ptr<interfaces::Echo> makeEcho() override { return interfaces::MakeEcho(); }
3743
interfaces::Ipc* ipc() override { return m_ipc.get(); }

src/init/bitcoind.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include <interfaces/chain.h>
6+
#include <interfaces/coinjoin.h>
67
#include <interfaces/echo.h>
78
#include <interfaces/init.h>
89
#include <interfaces/node.h>
910
#include <interfaces/wallet.h>
1011
#include <node/context.h>
12+
#include <util/check.h>
1113
#include <util/system.h>
1214

1315
#include <memory>
@@ -24,9 +26,13 @@ class BitcoindInit : public interfaces::Init
2426
}
2527
std::unique_ptr<interfaces::Node> makeNode() override { return interfaces::MakeNode(m_node); }
2628
std::unique_ptr<interfaces::Chain> makeChain() override { return interfaces::MakeChain(m_node); }
27-
std::unique_ptr<interfaces::WalletLoader> makeWalletLoader(interfaces::Chain& chain, const std::unique_ptr<interfaces::CoinJoin::Loader>& loader) override
29+
std::unique_ptr<interfaces::CoinJoin::Loader> makeCoinJoinLoader() override
2830
{
29-
return MakeWalletLoader(chain, loader, *Assert(m_node.args));
31+
return interfaces::MakeCoinJoinLoader(m_node);
32+
}
33+
std::unique_ptr<interfaces::WalletLoader> makeWalletLoader(interfaces::Chain& chain, interfaces::CoinJoin::Loader& coinjoin_loader) override
34+
{
35+
return MakeWalletLoader(chain, *Assert(m_node.args), coinjoin_loader);
3036
}
3137
std::unique_ptr<interfaces::Echo> makeEcho() override { return interfaces::MakeEcho(); }
3238
NodeContext& m_node;

src/interfaces/coinjoin.h

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

88
#include <memory>
99
#include <string>
10+
#include <vector>
1011

11-
class CoinJoinWalletManager;
1212
class CWallet;
13+
struct NodeContext;
14+
15+
class UniValue;
1316

1417
namespace interfaces {
1518
namespace CoinJoin {
@@ -21,6 +24,8 @@ class Client
2124
virtual void resetCachedBlocks() = 0;
2225
virtual void resetPool() = 0;
2326
virtual int getCachedBlocks() = 0;
27+
virtual void getJsonInfo(UniValue& obj) = 0;
28+
virtual std::vector<std::string> getSessionStatuses() = 0;
2429
virtual std::string getSessionDenoms() = 0;
2530
virtual void setCachedBlocks(int nCachedBlocks) = 0;
2631
virtual void disableAutobackups() = 0;
@@ -38,11 +43,10 @@ class Loader
3843
virtual void RemoveWallet(const std::string&) = 0;
3944
virtual void FlushWallet(const std::string&) = 0;
4045
virtual std::unique_ptr<CoinJoin::Client> GetClient(const std::string&) = 0;
41-
virtual CoinJoinWalletManager& walletman() = 0;
4246
};
4347
} // namespace CoinJoin
4448

45-
std::unique_ptr<CoinJoin::Loader> MakeCoinJoinLoader(CoinJoinWalletManager& walletman);
49+
std::unique_ptr<CoinJoin::Loader> MakeCoinJoinLoader(NodeContext& node);
4650

4751
} // namespace interfaces
4852

0 commit comments

Comments
 (0)