diff options
author | fanquake <fanquake@gmail.com> | 2021-08-19 09:18:28 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2021-08-19 09:42:21 +0800 |
commit | 638855af631e145ce06087e3e45e4d1caad4e995 (patch) | |
tree | 9416ed0f2676b8fed7eb3c7bd50d21922a10cf8b /src/interfaces/wallet.h | |
parent | 607a6338a73734bcdf6dc008f9f91e76efeb845f (diff) | |
parent | 62a09a30772141ef4add2f10d29927211abf57eb (diff) |
Merge bitcoin/bitcoin#19101: refactor: remove ::vpwallets and related global variables
62a09a30772141ef4add2f10d29927211abf57eb refactor: remove ::vpwallets and related global variables (Russell Yanofsky)
Pull request description:
Get rid of global wallet list variables by moving them to WalletContext struct
- [`cs_wallets`](https://github.com/bitcoin/bitcoin/blob/e638acf6970394f8eb1957366ad2d39512f33b31/src/wallet/wallet.cpp#L56) is now [`WalletContext::wallet_mutex`](https://github.com/ryanofsky/bitcoin/blob/4be544c7ec08a81952fd3f4349151cbb8bdb60e8/src/wallet/context.h#L37)
- [`vpwallets`](https://github.com/bitcoin/bitcoin/blob/e638acf6970394f8eb1957366ad2d39512f33b31/src/wallet/wallet.cpp#L57) is now [`WalletContext::wallets`](https://github.com/ryanofsky/bitcoin/blob/4be544c7ec08a81952fd3f4349151cbb8bdb60e8/src/wallet/context.h#L38)
- [`g_load_wallet_fns`](https://github.com/bitcoin/bitcoin/blob/e638acf6970394f8eb1957366ad2d39512f33b31/src/wallet/wallet.cpp#L58) is now [`WalletContext::wallet_load_fns`](https://github.com/ryanofsky/bitcoin/blob/4be544c7ec08a81952fd3f4349151cbb8bdb60e8/src/wallet/context.h#L39)
ACKs for top commit:
achow101:
ACK 62a09a30772141ef4add2f10d29927211abf57eb
meshcollider:
re-utACK 62a09a30772141ef4add2f10d29927211abf57eb
Tree-SHA512: 74428180d57b4214c3d96963e6ff43e8778f6f23b6880262d1272f2de67d02714fdc3ebb558f62e48655b221a642c36f80ef37c8f89d362e2d66fd93cbf03b8f
Diffstat (limited to 'src/interfaces/wallet.h')
-rw-r--r-- | src/interfaces/wallet.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index fb1febc11b..a85db04b8b 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -332,6 +332,9 @@ public: //! loaded at startup or by RPC. using LoadWalletFn = std::function<void(std::unique_ptr<Wallet> wallet)>; virtual std::unique_ptr<Handler> handleLoadWallet(LoadWalletFn fn) = 0; + + //! Return pointer to internal context, useful for testing. + virtual WalletContext* context() { return nullptr; } }; //! Information about one wallet address. @@ -410,7 +413,7 @@ struct WalletTxOut //! Return implementation of Wallet interface. This function is defined in //! dummywallet.cpp and throws if the wallet component is not compiled. -std::unique_ptr<Wallet> MakeWallet(const std::shared_ptr<CWallet>& wallet); +std::unique_ptr<Wallet> MakeWallet(WalletContext& context, const std::shared_ptr<CWallet>& wallet); //! Return implementation of ChainClient interface for a wallet client. This //! function will be undefined in builds where ENABLE_WALLET is false. |