From 6efd9644cfe31168db1841010cffa64dfe604e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Barbosa?= Date: Tue, 17 Apr 2018 17:41:49 +0100 Subject: [PATCH] refactor: Drop CWalletRef typedef --- src/interfaces/node.cpp | 2 +- src/wallet/init.cpp | 8 ++++---- src/wallet/rpcwallet.cpp | 4 ++-- src/wallet/wallet.cpp | 2 +- src/wallet/wallet.h | 7 +++---- src/wallet/walletdb.cpp | 2 +- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/interfaces/node.cpp b/src/interfaces/node.cpp index 919748f94..6d49117de 100644 --- a/src/interfaces/node.cpp +++ b/src/interfaces/node.cpp @@ -239,7 +239,7 @@ class NodeImpl : public Node { #ifdef ENABLE_WALLET std::vector> wallets; - for (CWalletRef wallet : ::vpwallets) { + for (CWallet* wallet : ::vpwallets) { wallets.emplace_back(MakeWallet(*wallet)); } return wallets; diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index 2fd9aa1a6..860e1cfac 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -323,28 +323,28 @@ bool WalletInit::Open() const void WalletInit::Start(CScheduler& scheduler) const { - for (CWalletRef pwallet : vpwallets) { + for (CWallet* pwallet : vpwallets) { pwallet->postInitProcess(scheduler); } } void WalletInit::Flush() const { - for (CWalletRef pwallet : vpwallets) { + for (CWallet* pwallet : vpwallets) { pwallet->Flush(false); } } void WalletInit::Stop() const { - for (CWalletRef pwallet : vpwallets) { + for (CWallet* pwallet : vpwallets) { pwallet->Flush(true); } } void WalletInit::Close() const { - for (CWalletRef pwallet : vpwallets) { + for (CWallet* pwallet : vpwallets) { delete pwallet; } vpwallets.clear(); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 56bdc0695..5298283b4 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -46,7 +46,7 @@ CWallet *GetWalletForJSONRPCRequest(const JSONRPCRequest& request) if (request.URI.substr(0, WALLET_ENDPOINT_BASE.size()) == WALLET_ENDPOINT_BASE) { // wallet endpoint was used std::string requestedWallet = urlDecode(request.URI.substr(WALLET_ENDPOINT_BASE.size())); - for (CWalletRef pwallet : ::vpwallets) { + for (CWallet* pwallet : ::vpwallets) { if (pwallet->GetName() == requestedWallet) { return pwallet; } @@ -2862,7 +2862,7 @@ UniValue listwallets(const JSONRPCRequest& request) UniValue obj(UniValue::VARR); - for (CWalletRef pwallet : vpwallets) { + for (CWallet* pwallet : vpwallets) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { return NullUniValue; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 45c85a791..dcf566c1e 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -33,7 +33,7 @@ #include -std::vector vpwallets; +std::vector vpwallets; /** Transaction fee set by the user */ CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE); unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index b85f374a0..ceac4ac58 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -32,8 +32,7 @@ #include #include -typedef CWallet* CWalletRef; -extern std::vector vpwallets; +extern std::vector vpwallets; /** * Settings @@ -1230,10 +1229,10 @@ std::vector GetAllDestinationsForKey(const CPubKey& key); class WalletRescanReserver { private: - CWalletRef m_wallet; + CWallet* m_wallet; bool m_could_reserve; public: - explicit WalletRescanReserver(CWalletRef w) : m_wallet(w), m_could_reserve(false) {} + explicit WalletRescanReserver(CWallet* w) : m_wallet(w), m_could_reserve(false) {} bool reserve() { diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index bcc7cf877..0e8a12ee9 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -756,7 +756,7 @@ void MaybeCompactWalletDB() return; } - for (CWalletRef pwallet : vpwallets) { + for (CWallet* pwallet : vpwallets) { WalletDatabase& dbh = pwallet->GetDBHandle(); unsigned int nUpdateCounter = dbh.nUpdateCounter;