From 884a53f607c49c31453644d4da46139bac82fd23 Mon Sep 17 00:00:00 2001 From: fosse Date: Wed, 24 Jan 2024 13:16:02 -0500 Subject: [PATCH] forgot to add to commit --- cw_bitcoin/lib/electrum_wallet.dart | 13 ++++++++----- cw_core/lib/node.dart | 4 +--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cw_bitcoin/lib/electrum_wallet.dart b/cw_bitcoin/lib/electrum_wallet.dart index 09dc24aa3..29c34701b 100644 --- a/cw_bitcoin/lib/electrum_wallet.dart +++ b/cw_bitcoin/lib/electrum_wallet.dart @@ -134,6 +134,8 @@ abstract class ElectrumWalletBase void Function(FlutterErrorDetails)? _onError; + bool torOnly = false; + Future init() async { await walletAddresses.init(); await transactionHistory.init(); @@ -163,16 +165,20 @@ abstract class ElectrumWalletBase } } + void setTorOnly(bool value) { + torOnly = value; + } + @action @override Future connectToNode({required Node node}) async { try { // we can't connect over tor in this wallet type (yet): - if (node.connectOverTorOnly) { + if (torOnly) { syncStatus = FailedSyncStatus(); return; } - + syncStatus = ConnectingSyncStatus(); await electrumClient.connectToUri(node.uri); electrumClient.onConnectionStatusChange = (bool isConnected) { @@ -607,8 +613,6 @@ abstract class ElectrumWalletBase electrumClient.getHistory(scriptHash).then((history) => {scriptHash: history})); final historyResults = await Future.wait(histories); - - historyResults.forEach((history) { history.entries.forEach((historyItem) { if (historyItem.value.isNotEmpty) { @@ -628,7 +632,6 @@ abstract class ElectrumWalletBase } } - addressHashes.forEach((sh, addressRecord) { addressRecord.txCount = newTxCounts[sh] ?? 0; }); diff --git a/cw_core/lib/node.dart b/cw_core/lib/node.dart index 45d95544b..d7f37e4af 100644 --- a/cw_core/lib/node.dart +++ b/cw_core/lib/node.dart @@ -62,9 +62,7 @@ class Node extends HiveObject with Keyable { @HiveField(6) String? socksProxyAddress; - - bool connectOverTorOnly = false; - + bool get isSSL => useSSL ?? false; bool get useSocksProxy => socksProxyAddress == null ? false : socksProxyAddress!.isNotEmpty;