add logging

This commit is contained in:
sneurlax 2024-02-15 17:14:01 -06:00
parent 3d942f3e0b
commit d00c205e6c
2 changed files with 8 additions and 6 deletions

View file

@ -47,13 +47,13 @@ class CachedElectrumXClient {
/// If the client is closed, use the callback to update it.
_checkElectrumAdapterClient() async {
if (electrumAdapterClient.peer.isClosed) {
Logging.instance.log(
"ElectrumAdapterClient is closed, reopening it...",
level: LogLevel.Info,
);
ElectrumClient? _electrumAdapterClient =
await electrumAdapterUpdateCallback?.call();
if (_electrumAdapterClient != null) {
await electrumAdapterUpdateCallback.call();
electrumAdapterClient = _electrumAdapterClient;
} else {
throw Exception("ElectrumAdapterClient is closed");
}
}
}

View file

@ -1296,6 +1296,8 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
}
Future<ElectrumClient> updateClient() async {
Logging.instance.log("Updating electrum node and ElectrumAdapterClient.",
level: LogLevel.Info);
await updateNode();
return electrumAdapterClient;
}