diff --git a/src/main/java/org/qortal/crosschain/Bitcoiny.java b/src/main/java/org/qortal/crosschain/Bitcoiny.java index 56c5b409..8bfa0646 100644 --- a/src/main/java/org/qortal/crosschain/Bitcoiny.java +++ b/src/main/java/org/qortal/crosschain/Bitcoiny.java @@ -29,6 +29,7 @@ import org.bitcoinj.wallet.SendRequest; import org.bitcoinj.wallet.Wallet; import org.qortal.api.model.SimpleForeignTransaction; import org.qortal.crypto.Crypto; +import org.qortal.settings.Settings; import org.qortal.utils.Amounts; import org.qortal.utils.BitTwiddling; @@ -409,9 +410,6 @@ public abstract class Bitcoiny implements ForeignBlockchain { Set walletTransactions = new HashSet<>(); Set keySet = new HashSet<>(); - // Set the number of consecutive empty batches required before giving up - final int numberOfAdditionalBatchesToSearch = 7; - int unusedCounter = 0; int ki = 0; do { @@ -438,12 +436,12 @@ public abstract class Bitcoiny implements ForeignBlockchain { if (areAllKeysUnused) { // No transactions - if (unusedCounter >= numberOfAdditionalBatchesToSearch) { + if (unusedCounter >= Settings.getInstance().getGapLimit()) { // ... and we've hit our search limit break; } // We haven't hit our search limit yet so increment the counter and keep looking - unusedCounter++; + unusedCounter += WALLET_KEY_LOOKAHEAD_INCREMENT; } else { // Some keys in this batch were used, so reset the counter unusedCounter = 0; diff --git a/src/main/java/org/qortal/settings/Settings.java b/src/main/java/org/qortal/settings/Settings.java index e0ed7306..7851e374 100644 --- a/src/main/java/org/qortal/settings/Settings.java +++ b/src/main/java/org/qortal/settings/Settings.java @@ -284,6 +284,13 @@ public class Settings { private Long testNtpOffset = null; + /* Foreign chains */ + + /** Set the number of consecutive empty addresses required before treating a wallet's transaction set as complete */ + private int gapLimit = 24; + + + // Data storage (QDN) /** Data storage enabled/disabled*/ @@ -872,6 +879,11 @@ public class Settings { } + public int getGapLimit() { + return this.gapLimit; + } + + public boolean isQdnEnabled() { return this.qdnEnabled; }