ensure we don't initialize mweb until we really have to

This commit is contained in:
Matthew Fosse 2024-08-23 18:04:26 -04:00
parent a0c315c4cf
commit 2552fb9552

View file

@ -208,7 +208,6 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
_feeRatesTimer = _feeRatesTimer =
Timer.periodic(const Duration(minutes: 1), (timer) async => await updateFeeRates()); Timer.periodic(const Duration(minutes: 1), (timer) async => await updateFeeRates());
if (!mwebEnabled) { if (!mwebEnabled) {
try { try {
await updateAllUnspents(); await updateAllUnspents();
@ -556,6 +555,8 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
if (!mwebEnabled) { if (!mwebEnabled) {
return; return;
} }
await getStub();
// add the mweb unspents to the list: // add the mweb unspents to the list:
List<BitcoinUnspent> mwebUnspentCoins = []; List<BitcoinUnspent> mwebUnspentCoins = [];
// update mweb unspents: // update mweb unspents:
@ -597,6 +598,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
if (!mwebEnabled) { if (!mwebEnabled) {
return balance; return balance;
} }
await getStub();
int confirmed = balance.confirmed; int confirmed = balance.confirmed;
int unconfirmed = balance.unconfirmed; int unconfirmed = balance.unconfirmed;
@ -758,6 +760,7 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
if (!mwebEnabled) { if (!mwebEnabled) {
return tx; return tx;
} }
await getStub();
final resp = await _stub.create(CreateRequest( final resp = await _stub.create(CreateRequest(
rawTx: hex.decode(tx.hex), rawTx: hex.decode(tx.hex),