REF: better LN wallet refresh strategy

This commit is contained in:
Overtorment 2019-06-01 21:45:01 +01:00
parent 3afeefaed9
commit 042a9e4d85
2 changed files with 3 additions and 2 deletions

View file

@ -55,11 +55,11 @@ export class LightningCustodianWallet extends LegacyWallet {
}
timeToRefreshBalance() {
return (+new Date() - this._lastBalanceFetch) / 1000 > 3600; // 1hr
return (+new Date() - this._lastBalanceFetch) / 1000 > 300; // 5 min
}
timeToRefreshTransaction() {
return (+new Date() - this._lastTxFetch) / 1000 > 3600; // 1hr
return (+new Date() - this._lastTxFetch) / 1000 > 300; // 5 min
}
static fromJson(param) {

View file

@ -191,6 +191,7 @@ export default class WalletsList extends Component {
}
if (wallets[index].fetchUserInvoices) {
await wallets[index].fetchUserInvoices();
await wallets[index].fetchBalance(); // chances are, paid ln invoice was processed during `fetchUserInvoices()` call and altered user's balance, so its worth fetching balance again
}
this.redrawScreen();
didRefresh = true;