From d00c205e6c703a62b392eac4d325baa9a5c6616f Mon Sep 17 00:00:00 2001 From: sneurlax Date: Thu, 15 Feb 2024 17:14:01 -0600 Subject: [PATCH] add logging --- lib/electrumx_rpc/cached_electrumx_client.dart | 12 ++++++------ .../wallet_mixin_interfaces/electrumx_interface.dart | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/electrumx_rpc/cached_electrumx_client.dart b/lib/electrumx_rpc/cached_electrumx_client.dart index 5b5ec6c99..780d6acd3 100644 --- a/lib/electrumx_rpc/cached_electrumx_client.dart +++ b/lib/electrumx_rpc/cached_electrumx_client.dart @@ -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) { - electrumAdapterClient = _electrumAdapterClient; - } else { - throw Exception("ElectrumAdapterClient is closed"); - } + await electrumAdapterUpdateCallback.call(); + electrumAdapterClient = _electrumAdapterClient; } } diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart index c881cb9d7..79f87d767 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart @@ -1296,6 +1296,8 @@ mixin ElectrumXInterface on Bip39HDWallet { } Future updateClient() async { + Logging.instance.log("Updating electrum node and ElectrumAdapterClient.", + level: LogLevel.Info); await updateNode(); return electrumAdapterClient; }