Skip to content

Commit

Permalink
Implement review suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
panleone committed Sep 19, 2023
1 parent 8dfeea7 commit 893afd2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
10 changes: 5 additions & 5 deletions scripts/masterkey.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class MasterKey {
* @return {void}
* @abstract
*/
wipePrivateData(nAccount) {
wipePrivateData(_nAccount) {
throw new Error('Not implemented');
}

Expand All @@ -77,7 +77,7 @@ export class MasterKey {
* @return {Promise<String>} public key to export. Only suitable for monitoring balance.
* @abstract
*/
getKeyToExport(nAccount) {
getKeyToExport(_nAccount) {
throw new Error('Not implemented');
}

Expand Down Expand Up @@ -220,7 +220,7 @@ export class HardwareWalletMasterKey extends MasterKey {
}

// Hardware Wallets don't have exposed private data
wipePrivateData() {}
wipePrivateData(_nAccount) {}

get isViewOnly() {
return false;
Expand Down Expand Up @@ -248,7 +248,7 @@ export class LegacyMasterKey extends MasterKey {
return this._address;
}

getKeyToExport() {
getKeyToExport(_nAccount) {
return this._address;
}

Expand All @@ -271,7 +271,7 @@ export class LegacyMasterKey extends MasterKey {
);
}

wipePrivateData() {
wipePrivateData(_nAccount) {
this._pkBytes = null;
this._isViewOnly = true;
}
Expand Down
10 changes: 5 additions & 5 deletions scripts/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { cChainParams, COIN } from './chain_params.js';
import { createAlert } from './misc.js';
import { Mempool, UTXO } from './mempool.js';
import { getEventEmitter } from './event_bus.js';
import { Wallet } from './wallet.js';
import {
STATS,
cStatKeys,
Expand Down Expand Up @@ -94,10 +93,10 @@ export class HistoricalTx {
*
*/
export class Network {
wallet;
/**
* @type {Wallet}
* @param {import('./wallet.js').Wallet} wallet
*/
wallet;
constructor(wallet) {
if (this.constructor === Network) {
throw new Error('Initializing virtual class');
Expand Down Expand Up @@ -251,7 +250,7 @@ export class ExplorerNetwork extends Network {
async getUTXOs(strAddress = '') {
// Don't fetch UTXOs if we're already scanning for them!
if (!strAddress) {
if (!this.wallet) return;
if (!this.wallet || !this.wallet.isLoaded()) return;
if (this.isSyncing) return;
this.isSyncing = true;
}
Expand Down Expand Up @@ -363,7 +362,8 @@ export class ExplorerNetwork extends Network {
return false;
}
try {
if (!this.enabled || !this.wallet) return this.arrTxHistory;
if (!this.enabled || !this.wallet || !this.wallet.isLoaded())
return this.arrTxHistory;
this.historySyncing = true;
const nHeight = this.arrTxHistory.length
? this.arrTxHistory[this.arrTxHistory.length - 1].blockHeight
Expand Down
3 changes: 1 addition & 2 deletions scripts/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { doms, beforeUnloadListener } from './global.js';
import { getNetwork } from './network.js';
import { MAX_ACCOUNT_GAP } from './chain_params.js';
import {
MasterKey,
LegacyMasterKey,
HdMasterKey,
HardwareWalletMasterKey,
Expand Down Expand Up @@ -39,7 +38,7 @@ export let fWalletLoaded = false;
*/
export class Wallet {
/**
* @type {MasterKey}
* @type {import('./masterkey.js').MasterKey}
*/
#masterKey;
/**
Expand Down

0 comments on commit 893afd2

Please sign in to comment.