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
This commit is contained in:
sneurlax 2023-10-21 19:35:15 -05:00 committed by julian-CStack
parent 41b3884427
commit 17fbf7f9ab
4 changed files with 3 additions and 11 deletions

View file

@ -55,8 +55,6 @@ class Bitcoincash extends Bip39HDCurrency with ElectrumXCurrencyInterface {
@override @override
int get maxUnusedAddressGap => 50; int get maxUnusedAddressGap => 50;
@override
int get maxNumberOfIndexesToCheck => 10000000;
@override @override
// change this to change the number of confirms a tx needs in order to show as confirmed // change this to change the number of confirms a tx needs in order to show as confirmed

View file

@ -50,8 +50,6 @@ class Ecash extends Bip39HDCurrency with ElectrumXCurrencyInterface {
@override @override
int get maxUnusedAddressGap => 50; int get maxUnusedAddressGap => 50;
@override
int get maxNumberOfIndexesToCheck => 10000000;
@override @override
// change this to change the number of confirms a tx needs in order to show as confirmed // change this to change the number of confirms a tx needs in order to show as confirmed

View file

@ -1,6 +1,7 @@
import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib; import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib;
import 'package:crypto/crypto.dart'; import 'package:crypto/crypto.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import '../../../models/isar/models/blockchain_data/address.dart'; import '../../../models/isar/models/blockchain_data/address.dart';
import '../../../utilities/amount/amount.dart'; import '../../../utilities/amount/amount.dart';
import '../../../utilities/enums/derive_path_type_enum.dart'; import '../../../utilities/enums/derive_path_type_enum.dart';
@ -16,7 +17,6 @@ abstract class Bip39HDCurrency extends Bip39Currency {
List<DerivePathType> get supportedDerivationPathTypes; List<DerivePathType> get supportedDerivationPathTypes;
int get maxUnusedAddressGap => 50; int get maxUnusedAddressGap => 50;
int get maxNumberOfIndexesToCheck => 10000;
String constructDerivePath({ String constructDerivePath({
required DerivePathType derivePathType, required DerivePathType derivePathType,

View file

@ -937,8 +937,7 @@ mixin ElectrumXInterface<T extends ElectrumXCurrencyInterface>
int highestIndexWithHistory = 0; int highestIndexWithHistory = 0;
for (int index = 0; for (int index = 0;
index < cryptoCurrency.maxNumberOfIndexesToCheck && gapCounter < cryptoCurrency.maxUnusedAddressGap;
gapCounter < cryptoCurrency.maxUnusedAddressGap;
index += txCountBatchSize) { index += txCountBatchSize) {
Logging.instance.log( Logging.instance.log(
"index: $index, \t GapCounter $chain ${type.name}: $gapCounter", "index: $index, \t GapCounter $chain ${type.name}: $gapCounter",
@ -1017,10 +1016,7 @@ mixin ElectrumXInterface<T extends ElectrumXCurrencyInterface>
final List<Address> addressArray = []; final List<Address> addressArray = [];
int gapCounter = 0; int gapCounter = 0;
int index = 0; int index = 0;
for (; for (; gapCounter < cryptoCurrency.maxUnusedAddressGap; index++) {
index < cryptoCurrency.maxNumberOfIndexesToCheck &&
gapCounter < cryptoCurrency.maxUnusedAddressGap;
index++) {
Logging.instance.log( Logging.instance.log(
"index: $index, \t GapCounter chain=$chain ${type.name}: $gapCounter", "index: $index, \t GapCounter chain=$chain ${type.name}: $gapCounter",
level: LogLevel.Info, level: LogLevel.Info,