Skip to content

Commit

Permalink
wallet: connect to node and load filter only after walletdb finished …
Browse files Browse the repository at this point in the history
…loading..
  • Loading branch information
nodech committed Oct 20, 2023
1 parent 086d9c9 commit b12650d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions lib/wallet/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ class Wallet extends EventEmitter {
const account = await this._createAccount(options, passphrase);
assert(account);

this.logger.info('Wallet initialized (%s).', this.id);
await this.txdb.open(this);

return this.txdb.open(this);
this.logger.info('Wallet initialized (%s).', this.id);
}

/**
Expand All @@ -215,9 +215,8 @@ class Wallet extends EventEmitter {
if (!account)
throw new Error('Default account not found.');

await this.txdb.open(this);
this.logger.info('Wallet opened (%s).', this.id);

return this.txdb.open(this);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/wallet/walletdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,10 @@ class WalletDB extends EventEmitter {
if (this.options.wipeNoReally)
await this.wipe();

await this.watch();
await this.loadState();

this.logger.info(
'WalletDB loaded (depth=%d, height=%d, start=%d).',
'WalletDB is loading (depth=%d, height=%d, start=%d).',
this.depth,
this.state.height,
this.state.startHeight);
Expand Down Expand Up @@ -240,6 +239,7 @@ class WalletDB extends EventEmitter {
}

await this.preloadAll();
await this.watch();

this.logger.info('WalletDB opened.');
this.emit('open');
Expand Down

0 comments on commit b12650d

Please sign in to comment.