diff --git a/lib/wallet/walletdb.js b/lib/wallet/walletdb.js index d1adc4fc..0f0274f1 100644 --- a/lib/wallet/walletdb.js +++ b/lib/wallet/walletdb.js @@ -143,11 +143,11 @@ function WalletDB(options) { this.network = Network.get(options.network); this.fees = options.fees; this.logger = options.logger || Logger.global; - this.wallets = {}; this.tip = this.network.genesis.hash; this.height = 0; this.depth = 0; + this.wallets = {}; // We need one read lock for `get` and `create`. // It will hold locks specific to wallet ids. @@ -232,6 +232,7 @@ WalletDB.prototype._close = co(function* close() { key = keys[i]; wallet = this.wallets[key]; yield wallet.destroy(); + delete this.wallets[key]; } yield this.db.close();