joinmarket-webui / jam

Your sats. Your privacy. Your profit.
https://jamapp.org
MIT License
236 stars 48 forks source link

Rescan takes many hours when importing existing wallet #743

Closed Lord-Lange closed 2 months ago

Lord-Lange commented 2 months ago

Expected behavior When importing an existing wallet, the rescan process should finish within a reasonable timeframe

Actual behavior When importing an existing wallet, the rescan process does not finish within a reasonable timeframe. The rescan process has been running for multiple hours now and have not finished yet. Jam open wallet

Steps to reproduce the problem

  1. Create new wallet via Jam
  2. Uninstall Jam
  3. Install Jam again
  4. Import the wallet that you just created

Specifications

Additional context

When creating the wallet i wanted to make sure, that I could recover it on via Jam. I unistalled Jam to remove the wallet info. When importing the wallet it has now been stuck rescanning for many hours.

theborakompanioni commented 2 months ago

Hey @Lord-Lange, thanks for your report. :pray:

First, this is Bitcoin Core rescanning the chain. It entirely depends on your hardware (and the starting block height).

What do you consider a "reasonable timeframe" to be?

Anyway, the only thing we can do is display the progress percentage - has been slightly discussed in https://github.com/JoinMarket-Org/joinmarket-clientserver/pull/1461#issuecomment-1486808184 Do you think that is okay?

Lord-Lange commented 2 months ago

Hey @Lord-Lange, thanks for your report. 🙏

First, this is Bitcoin Core rescanning the chain. It entirely depends on your hardware (and the starting block height).

What do you consider a "reasonable timeframe" to be?

Anyway, the only thing we can do is display the progress percentage - has been slightly discussed in JoinMarket-Org/joinmarket-clientserver#1461 (comment) Do you think that is okay?

Hey @theborakompanioni, thanks for replying so fast!

I chose to write "reasonable timeframe" because I don't know the actual process of the rescan and what is a realistic timeframe. For reference on a raspberry pi 4 with my current internet connection and SSD drive it took 3 or 4 days to install and load a full node in the beginning of the year, which is the hardware that i'm running Umbrel on.

Regarding the "reasonable timeframe" when I have tried recovering a wallet using sparrow on an old laptop, it usually doesn't take more than a few minutes at most. But maybe it's completely different than with Jam?

If the process take much longer than a few minutes or even hours I think it would be nice to see the process, otherwise it's easy to think that something has gone wrong.

kristapsk commented 2 months ago

Looking at JoinMarket Wallet RPC API currently, I see two things that could be improved (besides feedback of progress).

1) There is no way to specify rescan start date. If user knows when wallet was initially created, he could specify that date and rescan would be faster.

2) For segwit wallets there is no point of rescaning before segwit activation block, so that could be default instead of genesis.

theborakompanioni commented 2 months ago

Looking at JoinMarket Wallet RPC API currently, I see two things that could be improved (besides feedback of progress).

1. There is no way to specify rescan start date. If user knows when wallet was initially created, he could specify that date and rescan would be faster.

:+1:

2. For segwit wallets there is no point of rescaning before segwit activation block, so that could be default instead of genesis.

481824 is the default (in Jam).

kristapsk commented 2 months ago

Ohh, I'm an idiot, you can already specify that in /wallet/<string:walletname>/rescanblockchain/<int:blockheight>.

Does Jam currently ask user for rescan start date when recovering wallet? Guess not and some API that converts date to block height would be helpful?

theborakompanioni commented 2 months ago

Ohh, I'm an idiot,

No :wink:

you can already specify that in /wallet/<string:walletname>/rescanblockchain/<int:blockheight>.

Yes :upside_down_face:

Does Jam currently ask user for rescan start date when recovering wallet? Guess not and some API that converts date to block height would be helpful?

Currently, it is plain block height input. But a datepicker is on the roadmap.

kristapsk commented 2 months ago

https://github.com/JoinMarket-Org/joinmarket-clientserver/pull/1696

theborakompanioni commented 2 months ago

Closing this issue in favor of https://github.com/joinmarket-webui/jam/issues/744.

@Lord-Lange Again, thanks for reporting and triggering this improvement. Am very sorry we cannot speed up the process in the first place, but at least provide better visual feedback. Feel free to open another issue if you are not satisfied.