refactor: Drop CWalletRef typedef

pull/585/head
João Barbosa 7 years ago
parent 615f7c2884
commit 6efd9644cf

@ -239,7 +239,7 @@ class NodeImpl : public Node
{ {
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
std::vector<std::unique_ptr<Wallet>> wallets; std::vector<std::unique_ptr<Wallet>> wallets;
for (CWalletRef wallet : ::vpwallets) { for (CWallet* wallet : ::vpwallets) {
wallets.emplace_back(MakeWallet(*wallet)); wallets.emplace_back(MakeWallet(*wallet));
} }
return wallets; return wallets;

@ -323,28 +323,28 @@ bool WalletInit::Open() const
void WalletInit::Start(CScheduler& scheduler) const void WalletInit::Start(CScheduler& scheduler) const
{ {
for (CWalletRef pwallet : vpwallets) { for (CWallet* pwallet : vpwallets) {
pwallet->postInitProcess(scheduler); pwallet->postInitProcess(scheduler);
} }
} }
void WalletInit::Flush() const void WalletInit::Flush() const
{ {
for (CWalletRef pwallet : vpwallets) { for (CWallet* pwallet : vpwallets) {
pwallet->Flush(false); pwallet->Flush(false);
} }
} }
void WalletInit::Stop() const void WalletInit::Stop() const
{ {
for (CWalletRef pwallet : vpwallets) { for (CWallet* pwallet : vpwallets) {
pwallet->Flush(true); pwallet->Flush(true);
} }
} }
void WalletInit::Close() const void WalletInit::Close() const
{ {
for (CWalletRef pwallet : vpwallets) { for (CWallet* pwallet : vpwallets) {
delete pwallet; delete pwallet;
} }
vpwallets.clear(); vpwallets.clear();

@ -46,7 +46,7 @@ CWallet *GetWalletForJSONRPCRequest(const JSONRPCRequest& request)
if (request.URI.substr(0, WALLET_ENDPOINT_BASE.size()) == WALLET_ENDPOINT_BASE) { if (request.URI.substr(0, WALLET_ENDPOINT_BASE.size()) == WALLET_ENDPOINT_BASE) {
// wallet endpoint was used // wallet endpoint was used
std::string requestedWallet = urlDecode(request.URI.substr(WALLET_ENDPOINT_BASE.size())); std::string requestedWallet = urlDecode(request.URI.substr(WALLET_ENDPOINT_BASE.size()));
for (CWalletRef pwallet : ::vpwallets) { for (CWallet* pwallet : ::vpwallets) {
if (pwallet->GetName() == requestedWallet) { if (pwallet->GetName() == requestedWallet) {
return pwallet; return pwallet;
} }
@ -2862,7 +2862,7 @@ UniValue listwallets(const JSONRPCRequest& request)
UniValue obj(UniValue::VARR); UniValue obj(UniValue::VARR);
for (CWalletRef pwallet : vpwallets) { for (CWallet* pwallet : vpwallets) {
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue; return NullUniValue;

@ -33,7 +33,7 @@
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
std::vector<CWalletRef> vpwallets; std::vector<CWallet*> vpwallets;
/** Transaction fee set by the user */ /** Transaction fee set by the user */
CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE); CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE);
unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET; unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET;

@ -32,8 +32,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
typedef CWallet* CWalletRef; extern std::vector<CWallet*> vpwallets;
extern std::vector<CWalletRef> vpwallets;
/** /**
* Settings * Settings
@ -1230,10 +1229,10 @@ std::vector<CTxDestination> GetAllDestinationsForKey(const CPubKey& key);
class WalletRescanReserver class WalletRescanReserver
{ {
private: private:
CWalletRef m_wallet; CWallet* m_wallet;
bool m_could_reserve; bool m_could_reserve;
public: 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() bool reserve()
{ {

@ -756,7 +756,7 @@ void MaybeCompactWalletDB()
return; return;
} }
for (CWalletRef pwallet : vpwallets) { for (CWallet* pwallet : vpwallets) {
WalletDatabase& dbh = pwallet->GetDBHandle(); WalletDatabase& dbh = pwallet->GetDBHandle();
unsigned int nUpdateCounter = dbh.nUpdateCounter; unsigned int nUpdateCounter = dbh.nUpdateCounter;

Loading…
Cancel
Save