aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/wallet.cpp
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2018-05-22 16:18:07 +0100
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2018-05-22 16:56:20 +0100
commit80b4910f7d87983f50047074c3c2397b0a5c4e92 (patch)
tree0bd471d1bc9b659b52033bd333cfe9b433e9b4e1 /src/interfaces/wallet.cpp
parent6916024768ec57a00f54224640ab4e4871d2a30a (diff)
downloadbitcoin-80b4910f7d87983f50047074c3c2397b0a5c4e92.tar.xz
wallet: Use shared pointer to retain wallet instance
Diffstat (limited to 'src/interfaces/wallet.cpp')
-rw-r--r--src/interfaces/wallet.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp
index 63b9d80a92..3029dbe8e3 100644
--- a/src/interfaces/wallet.cpp
+++ b/src/interfaces/wallet.cpp
@@ -118,7 +118,7 @@ WalletTxOut MakeWalletTxOut(CWallet& wallet, const CWalletTx& wtx, int n, int de
class WalletImpl : public Wallet
{
public:
- WalletImpl(CWallet& wallet) : m_wallet(wallet) {}
+ WalletImpl(const std::shared_ptr<CWallet>& wallet) : m_shared_wallet(wallet), m_wallet(*wallet.get()) {}
bool encryptWallet(const SecureString& wallet_passphrase) override
{
@@ -453,11 +453,12 @@ public:
return MakeHandler(m_wallet.NotifyWatchonlyChanged.connect(fn));
}
+ std::shared_ptr<CWallet> m_shared_wallet;
CWallet& m_wallet;
};
} // namespace
-std::unique_ptr<Wallet> MakeWallet(CWallet& wallet) { return MakeUnique<WalletImpl>(wallet); }
+std::unique_ptr<Wallet> MakeWallet(const std::shared_ptr<CWallet>& wallet) { return MakeUnique<WalletImpl>(wallet); }
} // namespace interfaces