LedgerHQ / satstack

Bitcoin full node with Ledger Live
BSD 2-Clause "Simplified" License
159 stars 32 forks source link

Account scan repeating #90

Open dannuttall opened 1 year ago

dannuttall commented 1 year ago

When setting up Satstack for the first time, after it syncs, it then runs an "account scan". After reaching 100% on the account scan it just repeats. It's taking a very long time! Is this normal? Does it need to repeat for each account (there's only 4 on my ledger)? Maybe I'm just being impatient, but if it does need to repeat for each account, the instructions don't mention it so it's not obvious.

SkanderHelali commented 1 year ago

Ledger Live seems to add 10 accounts for every single script type to the config. So it'll run through all of them and take quite a long time.

It doesn't persist between lss launches, not sure if this is the intended behavior. It will repeat the process in its entirety with every lss service restart / reboot.

dannuttall commented 1 year ago

It's now been running for 48 hours, each account scan repeat takes 4hrs 30mins so that's over 10 scans so I'm assuming there's an issue here.

Steps to reproduce:

  1. Running raspiblitz on a rp4 on my local network.
  2. Running Ledger Live on my desktop on the same network.
  3. Node connection from Ledger live successful.
  4. Downloaded SatStack to a folder on my desktop.
  5. Run lss via command prompt (as administrator) and the descriptor import begins.
  6. No lss.json file is created as far as I can tell (unless it's created elsewhere), so no descriptors are being saved so I'm assuming that's where the issue lies? Just guessing after reviewing issue #86
adrienlacombe commented 1 year ago

hi @dannuttall if you use Ledger Live to generate the lss.json, please locate it and use it.

dannuttall commented 1 year ago

@adrienlacombe-ledger ok I found it in the appdata folder. What do you mean by "use it"? Looking at the json file, it lists 44 accounts. 11 beginning "wpkh", "tr", "sh" and "pkh". (not sure what they mean). I only have the one bitcoin account in ledger live so not sure why there's so many. Does this mean I should input 44 (or 11?) accounts into the setup before scanning for accounts?

SkanderHelali commented 1 year ago

@adrienlacombe-ledger Ledger Live adds 10/11 accounts for every script type in the conf regardless of how many accounts you select during setup.

And once all of them are imported after an eternity; the process has to repeat all over again with every lss restart.

adrienlacombe commented 1 year ago

ok @dannuttall @SkanderHelali please edit the file manually to keep it simple, pkh is for legacy, sh for segwit, wpkh for native segwit and tr for taproot, feel free to delete what's not needed.

dannuttall commented 1 year ago

@adrienlacombe-ledger just noticed in the readme that the "simple" way won't work if the node is behind Tor (which mine is), so I suspect that's where my issue lies, even if I delete the unnecessary stuff from the lss.json file, unless Tor is now supported via the simple route?

adrienlacombe commented 1 year ago

@dannuttall good catch! No, it is not, you would need to edit the file manually as explained in the advanced part.

plk commented 1 year ago

Is someone able to explain what is supposed to happen with SatStack - I have just one TR account in lss.json and the "Account scan in progress" message reaches 100% and then just starts again with lss just spitting out endless 200 success REST calls to /blockchain/v3/explorer/status in 7 call blocks with an "Importing descriptors" message in between.

adrienlacombe commented 1 year ago

is Ledger Live stating that it is synchronized successfully @plk ?

plk commented 1 year ago

@adrienlacombe-ledger - No, it just reaches 100% and starts again from 0% ... I am just now trying the manual approach using the descriptors returned from getdescriptor and a much more recent birthday value in lss.json

Or do you mean the usual green "synchronised" check at the top of the app? That's green and fine - it's the "Account scan in progress" thing in the experimental features|bitcoin full node that seems to go in a circle, confirmed by the terminal output of lss which seems to just go back to 0% and continues making the same REST calls.

plk commented 1 year ago

Update - same thing with manual getdescriptor generated lss.json. With a more recent birthday setting, it was much faster but it still got to 100% and then just started again immediately at 0%.

adrienlacombe commented 1 year ago

ok, I meant the check indeed. The REST calls are made by Ledger Live, not satstack. If you leave aside the experimental features screen, can you add Bitcoin accounts in Ledger Live?

plk commented 1 year ago

Ah, it did finished after a few 0-100% runs and now says "Ready". My bitcoin accounts are still in LL - they were not removed but the sync sign in the "accounts" pane is a little DB icon and checkmark instead of just a checkmark - does this mean they are connected via my node or do I have to remove and re-add? According to the docs, it seems that the accounts should have been removed and I need to re-add ...

adrienlacombe commented 1 year ago

No need to remove and re-add. The doc assumed you started with 0 account but in your case you should be good to go to start using LL while enjoying not doxxing your txs to Ledger :)

plk commented 1 year ago

Hmm, I removed and re-added before I saw this and it found the accounts but they report 0 balance?

adrienlacombe commented 1 year ago

if the account has a positive balance it could mean that the descriptors use a different scheme and/or there are sync issues.

plk commented 1 year ago

Presumably I can switch back to the Ledger explorer anyway and re-add?

plk commented 1 year ago

Seems fine with the ledger explorer, just my node shows an empty balance for the account. I used the descriptor from the manual script output.

adrienlacombe commented 1 year ago

Are you sure you are on the same scheme?

plk commented 1 year ago

By scheme you mean Segwit/Taproot etc.? I am only trying to sync the taproot account which works fine with Ledger explorers.

adrienlacombe commented 1 year ago

Correct, ok, this is strange then.

plk commented 1 year ago

When I try to sync the taproot account via SatStack, I see the REST requests being made from LL but the balance remains 0. Delete, disable full-node connectivity, re-add via LL nodes - all fine. Using latest full node (22.0), SatStack and LL.

plk commented 1 year ago

I think I am a bit confused as to what is in the lss.json - Adding accounts seems to find a few (I had some Segwit etc., now empty) but there is only the taproot account in lss.json. I set the birthday in lss.json to just before this TR account was created, which I assume is correct.