Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wallet.sync() is scanning 200 addresses #44

Open
Czino opened this issue Jun 13, 2023 · 6 comments
Open

wallet.sync() is scanning 200 addresses #44

Czino opened this issue Jun 13, 2023 · 6 comments

Comments

@Czino
Copy link
Contributor

Czino commented Jun 13, 2023

When syncing, even after after creating a fresh wallet with a stopGap setting of 5, I am logging 200 requests on my electrum server.

Changing the stopGap does not have any influence on these 200 requests. I even set it to 500 but still only see 200 requests.

I cannot find any setting to change the number of initial addresses to be scanned but I would expect it to be much lower (10/25/50)

Tested with BlockchainEsploraConfig and BlockchainElectrumConfig
Tested on Android and iOS

@Czino
Copy link
Contributor Author

Czino commented Jun 13, 2023

So far debugging and finding that stopGap and timeout and mixed up for Esplora

in src/classes/Blockchain.ts:31
stopGap is the 5th argument
this.id = await this._bdk.initEsploraBlockchain(url, proxy, concurrency, timeout, stopGap);

android/src/main/java/io/ltbl/bdkrn/BdkRnModule.kt:232
expecting stopGap to be the 4th argument

@ReactMethod
    fun initEsploraBlockchain(
        url: String,
        proxy: String?,
        concurrency: String?,
        stopGap: String?,
        timeOut: String?,
        result: Promise
    )

ios/BdkRnModule.swift:287
expecting stopGap to be the 4th argument

@objc
    func initEsploraBlockchain(_
        url: String,
        proxy: String?,
        concurrency: String?,
        stopGap: String?,
        timeOut: String?,
        resolve: @escaping RCTPromiseResolveBlock,
        reject: @escaping RCTPromiseRejectBlock
    )

@Czino
Copy link
Contributor Author

Czino commented Jun 13, 2023

After fixing it with #46, I inspected the stopGap in android and now I receive the same value I passed.

However, bdk-rn is still scanning 200 addresses.

@BitcoinZavior
Copy link
Contributor

Thanks, @Czino will debug and see what could be wrong.

@BitcoinZavior
Copy link
Contributor

@Czino you might also want to check the value for concurrency: String?
https://docs.rs/bdk/latest/bdk/blockchain/esplora/struct.EsploraBlockchainConfig.html

@Czino
Copy link
Contributor Author

Czino commented Jun 14, 2023

@BitcoinZavior yes, I am already using concurrency to speed things up a little

@Czino
Copy link
Contributor Author

Czino commented Jun 23, 2023

debugging this issue a little, even after forcing stopGap to be 1, still 200 addresses are being scanned

 let _blockchainConfig = BlockchainConfig.esplora(
    config: EsploraConfig(
        baseUrl: baseUrl,
        proxy: proxy.isEmpty ? nil : proxy,
        concurrency: UInt8(truncating: concurrency),
        stopGap: 1,
        timeout: UInt64(truncating: timeout)
    )
)

Looks to me like we need to escalate the issue to bdk-ffi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants