wallet: add logs.
This commit is contained in:
parent
b39554fa98
commit
eaf2fa5ea2
@ -183,6 +183,7 @@ WalletDB.prototype.load = async function load() {
|
||||
WalletDB.prototype.resync = async function resync() {
|
||||
const unlock = await this.txLock.lock();
|
||||
try {
|
||||
this.logger.info('Resyncing from server...');
|
||||
await this.setFilter();
|
||||
await this.sync();
|
||||
await this.resend();
|
||||
@ -298,6 +299,8 @@ WalletDB.prototype.init = async function init() {
|
||||
return;
|
||||
}
|
||||
|
||||
this.logger.info('Initializing database state from server.');
|
||||
|
||||
const b = this.db.batch();
|
||||
|
||||
let tip = null;
|
||||
@ -389,6 +392,8 @@ WalletDB.prototype.sync = async function sync() {
|
||||
let height = this.state.height;
|
||||
let entry = null;
|
||||
|
||||
this.logger.info('Syncing state from height %d.', height);
|
||||
|
||||
for (;;) {
|
||||
const tip = await this.getBlock(height);
|
||||
assert(tip);
|
||||
@ -516,6 +521,9 @@ WalletDB.prototype.setFilter = function setFilter() {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
this.logger.info('Sending filter to server (%dmb).',
|
||||
this.filter.size / 8 / (1 << 20));
|
||||
|
||||
return this.client.setFilter(this.filter);
|
||||
};
|
||||
|
||||
@ -1286,6 +1294,8 @@ WalletDB.prototype.resend = async function resend() {
|
||||
parse: k => layout.ww(k)
|
||||
});
|
||||
|
||||
this.logger.info('Resending from %d wallets.', wids.length);
|
||||
|
||||
for (const wid of wids)
|
||||
await this.resendPending(wid);
|
||||
};
|
||||
@ -1700,7 +1710,7 @@ WalletDB.prototype.rollback = async function rollback(height) {
|
||||
throw new Error('WDB: Cannot rollback to the future.');
|
||||
|
||||
if (height === this.state.height) {
|
||||
this.logger.debug('Rolled back to same height (%d).', height);
|
||||
this.logger.info('Rolled back to same height (%d).', height);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user