From 17fbf7f9ab5a583b4d8d03a6f9a09b9fa316615d Mon Sep 17 00:00:00 2001 From: sneurlax Date: Sat, 21 Oct 2023 19:35:15 -0500 Subject: [PATCH] reconfigure logic for rescan for other wallets to remove upper limit now we will continue beyond maxNumberOfIndexesToCheck if there's activity beyond that point. we just keep scanning up until the unused activity gap --- lib/wallets/crypto_currency/coins/bitcoincash.dart | 2 -- lib/wallets/crypto_currency/coins/ecash.dart | 2 -- .../crypto_currency/intermediate/bip39_hd_currency.dart | 2 +- .../wallet_mixin_interfaces/electrumx_interface.dart | 8 ++------ 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/wallets/crypto_currency/coins/bitcoincash.dart b/lib/wallets/crypto_currency/coins/bitcoincash.dart index 5950fc913..9d9a291a8 100644 --- a/lib/wallets/crypto_currency/coins/bitcoincash.dart +++ b/lib/wallets/crypto_currency/coins/bitcoincash.dart @@ -55,8 +55,6 @@ class Bitcoincash extends Bip39HDCurrency with ElectrumXCurrencyInterface { @override int get maxUnusedAddressGap => 50; - @override - int get maxNumberOfIndexesToCheck => 10000000; @override // change this to change the number of confirms a tx needs in order to show as confirmed diff --git a/lib/wallets/crypto_currency/coins/ecash.dart b/lib/wallets/crypto_currency/coins/ecash.dart index 102f509c8..ad1ec4f6c 100644 --- a/lib/wallets/crypto_currency/coins/ecash.dart +++ b/lib/wallets/crypto_currency/coins/ecash.dart @@ -50,8 +50,6 @@ class Ecash extends Bip39HDCurrency with ElectrumXCurrencyInterface { @override int get maxUnusedAddressGap => 50; - @override - int get maxNumberOfIndexesToCheck => 10000000; @override // change this to change the number of confirms a tx needs in order to show as confirmed diff --git a/lib/wallets/crypto_currency/intermediate/bip39_hd_currency.dart b/lib/wallets/crypto_currency/intermediate/bip39_hd_currency.dart index bbe5bd2ab..bb97b6754 100644 --- a/lib/wallets/crypto_currency/intermediate/bip39_hd_currency.dart +++ b/lib/wallets/crypto_currency/intermediate/bip39_hd_currency.dart @@ -1,6 +1,7 @@ import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; import 'package:crypto/crypto.dart'; import 'package:flutter/foundation.dart'; + import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../utilities/amount/amount.dart'; import '../../../utilities/enums/derive_path_type_enum.dart'; @@ -16,7 +17,6 @@ abstract class Bip39HDCurrency extends Bip39Currency { List get supportedDerivationPathTypes; int get maxUnusedAddressGap => 50; - int get maxNumberOfIndexesToCheck => 10000; String constructDerivePath({ required DerivePathType derivePathType, diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart index c7b8aa259..035ae649f 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart @@ -937,8 +937,7 @@ mixin ElectrumXInterface int highestIndexWithHistory = 0; for (int index = 0; - index < cryptoCurrency.maxNumberOfIndexesToCheck && - gapCounter < cryptoCurrency.maxUnusedAddressGap; + gapCounter < cryptoCurrency.maxUnusedAddressGap; index += txCountBatchSize) { Logging.instance.log( "index: $index, \t GapCounter $chain ${type.name}: $gapCounter", @@ -1017,10 +1016,7 @@ mixin ElectrumXInterface final List
addressArray = []; int gapCounter = 0; int index = 0; - for (; - index < cryptoCurrency.maxNumberOfIndexesToCheck && - gapCounter < cryptoCurrency.maxUnusedAddressGap; - index++) { + for (; gapCounter < cryptoCurrency.maxUnusedAddressGap; index++) { Logging.instance.log( "index: $index, \t GapCounter chain=$chain ${type.name}: $gapCounter", level: LogLevel.Info,