wallet: Add AddWallet, RemoveWallet, GetWallet and GetWallets

With these new functions all vpwallets usage are removed
and vpwallets is now a static variable (no external linkage).
This commit is contained in:
João Barbosa
2018-04-17 18:22:23 +01:00
parent 6efd9644cf
commit 373aee26c3
9 changed files with 72 additions and 38 deletions

View File

@@ -315,7 +315,7 @@ bool WalletInit::Open() const
if (!pwallet) {
return false;
}
vpwallets.push_back(pwallet);
AddWallet(pwallet);
}
return true;
@@ -323,29 +323,29 @@ bool WalletInit::Open() const
void WalletInit::Start(CScheduler& scheduler) const
{
for (CWallet* pwallet : vpwallets) {
for (CWallet* pwallet : GetWallets()) {
pwallet->postInitProcess(scheduler);
}
}
void WalletInit::Flush() const
{
for (CWallet* pwallet : vpwallets) {
for (CWallet* pwallet : GetWallets()) {
pwallet->Flush(false);
}
}
void WalletInit::Stop() const
{
for (CWallet* pwallet : vpwallets) {
for (CWallet* pwallet : GetWallets()) {
pwallet->Flush(true);
}
}
void WalletInit::Close() const
{
for (CWallet* pwallet : vpwallets) {
for (CWallet* pwallet : GetWallets()) {
RemoveWallet(pwallet);
delete pwallet;
}
vpwallets.clear();
}