From 8db11dd0b182a93042899651545cc21b34bf0742 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Tue, 30 May 2017 15:55:17 -0400 Subject: Pass chain and client variables where needed This commit does not change behavior. All it does is pass new function parameters. It is easiest to review this change with: git log -p -n1 -U0 --word-diff-regex=. --- src/bench/coin_selection.cpp | 7 +++++-- src/bitcoind.cpp | 8 ++++++-- src/dummywallet.cpp | 4 ++-- src/init.cpp | 10 ++++++---- src/init.h | 17 +++++++++++++---- src/interfaces/node.cpp | 8 ++++++-- src/qt/test/addressbooktests.cpp | 4 +++- src/qt/test/wallettests.cpp | 4 +++- src/rpc/rawtransaction.cpp | 6 ++++-- src/rpc/rawtransaction.h | 6 +++++- src/rpc/util.cpp | 2 ++ src/rpc/util.h | 6 ++++++ src/test/rpc_tests.cpp | 7 +++++++ src/wallet/init.cpp | 12 ++++++------ src/wallet/rpcwallet.cpp | 19 ++++++++++--------- src/wallet/test/coinselector_tests.cpp | 3 ++- src/wallet/test/init_test_fixture.h | 2 ++ src/wallet/test/init_tests.cpp | 14 +++++++------- src/wallet/test/wallet_test_fixture.cpp | 2 +- src/wallet/test/wallet_test_fixture.h | 3 +++ src/wallet/test/wallet_tests.cpp | 23 +++++++++++++++-------- src/wallet/wallet.cpp | 10 +++++----- src/wallet/wallet.h | 16 +++++++++++++--- src/walletinitinterface.h | 8 ++++++-- 24 files changed, 138 insertions(+), 63 deletions(-) diff --git a/src/bench/coin_selection.cpp b/src/bench/coin_selection.cpp index decdadfb26..8552ed34fd 100644 --- a/src/bench/coin_selection.cpp +++ b/src/bench/coin_selection.cpp @@ -3,6 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include +#include #include #include @@ -33,7 +34,8 @@ static void addCoin(const CAmount& nValue, const CWallet& wallet, std::vector CoinSet; -static const CWallet testWallet(WalletLocation(), WalletDatabase::CreateDummy()); +static auto testChain = interfaces::MakeChain(); +static const CWallet testWallet(*testChain, WalletLocation(), WalletDatabase::CreateDummy()); std::vector> wtxn; // Copied from src/wallet/test/coinselector_tests.cpp diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index c6e2a7c20a..1306ba3821 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -58,6 +59,9 @@ static void WaitForShutdown() // static bool AppInit(int argc, char* argv[]) { + InitInterfaces interfaces; + interfaces.chain = interfaces::MakeChain(); + bool fRet = false; // @@ -164,7 +168,7 @@ static bool AppInit(int argc, char* argv[]) // If locking the data directory failed, exit immediately return false; } - fRet = AppInitMain(); + fRet = AppInitMain(interfaces); } catch (const std::exception& e) { PrintExceptionContinue(&e, "AppInit()"); @@ -178,7 +182,7 @@ static bool AppInit(int argc, char* argv[]) } else { WaitForShutdown(); } - Shutdown(); + Shutdown(interfaces); return fRet; } diff --git a/src/dummywallet.cpp b/src/dummywallet.cpp index 2a9b297029..fa232d2dd0 100644 --- a/src/dummywallet.cpp +++ b/src/dummywallet.cpp @@ -15,8 +15,8 @@ public: void AddWalletOptions() const override; bool ParameterInteraction() const override {return true;} void RegisterRPC(CRPCTable &) const override {} - bool Verify() const override {return true;} - bool Open() const override {LogPrintf("No wallet support compiled in!\n"); return true;} + bool Verify(interfaces::Chain& chain) const override {return true;} + bool Open(interfaces::Chain& chain) const override {LogPrintf("No wallet support compiled in!\n"); return true;} void Start(CScheduler& scheduler) const override {} void Flush() const override {} void Stop() const override {} diff --git a/src/init.cpp b/src/init.cpp index d54d4a8782..88d4d059f9 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include