From 5475a994cf60d513d878c0ab3f12a4cb64301324 Mon Sep 17 00:00:00 2001 From: Chris Stewart Date: Sat, 19 Mar 2022 19:02:32 -0500 Subject: [PATCH] Bump default address gap limit to 100, add log indicating we didn't find funds in the last addressBatchSize addresses (#4201) --- .../bitcoins/core/api/wallet/NeutrinoWalletApi.scala | 2 +- db-commons/src/main/resources/reference.conf | 2 +- docs/config/configuration.md | 11 +++++++++-- .../org/bitcoins/wallet/internal/RescanHandling.scala | 3 ++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/core/src/main/scala/org/bitcoins/core/api/wallet/NeutrinoWalletApi.scala b/core/src/main/scala/org/bitcoins/core/api/wallet/NeutrinoWalletApi.scala index f0ba5de62b..78b58b367e 100644 --- a/core/src/main/scala/org/bitcoins/core/api/wallet/NeutrinoWalletApi.scala +++ b/core/src/main/scala/org/bitcoins/core/api/wallet/NeutrinoWalletApi.scala @@ -87,7 +87,7 @@ trait NeutrinoWalletApi { self: WalletApi => addressBatchSize = addressBatchSize, useCreationTime = false) - def discoveryBatchSize(): Int = 25 + def discoveryBatchSize(): Int } diff --git a/db-commons/src/main/resources/reference.conf b/db-commons/src/main/resources/reference.conf index 3f60b8bc3e..50caf8d4e9 100644 --- a/db-commons/src/main/resources/reference.conf +++ b/db-commons/src/main/resources/reference.conf @@ -115,7 +115,7 @@ bitcoin-s { bloomFalsePositiveRate = 0.0001 # percentage - addressGapLimit = 20 + addressGapLimit = 100 discoveryBatchSize = 100 diff --git a/docs/config/configuration.md b/docs/config/configuration.md index 88f363b892..970547dfab 100644 --- a/docs/config/configuration.md +++ b/docs/config/configuration.md @@ -224,8 +224,15 @@ bitcoin-s { bloomFalsePositiveRate = 0.0001 # percentage - addressGapLimit = 20 - + # the number of consecutive addresses that we do not + # discover funds in before we mark as rescan as exhausted + # this is needed because we can never truely tell how many addresses + # the wallet has used when executing a rescan from a seed + addressGapLimit = 100 + + # the number of addresses that get generated everytime + # we need to rescan. If a match occurs within the addressGapLimit + # we generate another discoveryBatchSize addresses and then rescan again discoveryBatchSize = 100 requiredConfirmations = 6 diff --git a/wallet/src/main/scala/org/bitcoins/wallet/internal/RescanHandling.scala b/wallet/src/main/scala/org/bitcoins/wallet/internal/RescanHandling.scala index cdc6d386bc..e30e3c4c9b 100644 --- a/wallet/src/main/scala/org/bitcoins/wallet/internal/RescanHandling.scala +++ b/wallet/src/main/scala/org/bitcoins/wallet/internal/RescanHandling.scala @@ -156,7 +156,8 @@ private[wallet] trait RescanHandling extends WalletLogger { if ( externalGap >= walletConfig.addressGapLimit && changeGap >= walletConfig.addressGapLimit ) { - //done rescanning + logger.info( + s"Did not find any funds within the last ${walletConfig.addressGapLimit} addresses. Stopping our rescan.") Future.unit } else { logger.info(