KomodoPlatform / komodo-wallet

Komodo Wallet
https://app.komodoplatform.com
239 stars 206 forks source link

[FR]: Enhance Pirate sync #2362

Closed smk762 closed 10 months ago

smk762 commented 1 year ago

Currently there are a few quirks with ARR activation (depending on API version and params used). After some discussion with @cipig and @borngraced and feedback from PIRATE team, a few cases and options have been mentioned as below.

use_cache should default to true

On GUI side, setting the date to sync from in settings is suboptimal:

This could be solved by:

I think the table below summarises what I would expect from a variety of sync_params value cases image

@cipig @borngraced please add any extra info or ideas in this issue so we can find the best path for the next release.

cipig commented 1 year ago

i don't see the need for additional use_cache param the default, when activating without date param set, is to continue from where it stopped, aka use_cache, even if interrupted on previous run (eg by stopping app before sync finished)

the behavior of latest mm2 from dev branch (including https://github.com/KomodoPlatform/komodo-defi-framework/pull/1967) is to overwrite the cache/DB when activating with date param set... it then starts with a clean DB, but at that date... if no sync param set, it continues from where it stopped

the only 2 cases for setting a date sync param is on first start (when no cache/DB there) to make the first sync faster by specifying a date... and when someone wants to forcefully reset DB and resync

if the app would not pass date param at all after a restart of the app, but would do it only in the current session, it would solve the current problem and cover all usecases (i guess this can be achieved by simply not saving the date in cfg.ini, have the variable only set in current session and only pass sync params to ARRR activation when a date is set)

if user activates for the first time it starts at a default (eg 7 days ago, if user hasn't set something else before first activation)... this does not take long... if user is missing balance (eg because utxos older then 7 days in wallet), he would need to disable ARRR, set a date and enable ARRR... the activation would pass the date and mm2 would resync from that date

if user just wants to reset the DB and start again from a specified date, same procedure

in all other cases, it would continue from it where it stopped

EDIT: we could add a button "resync/reset ARRR" in settings... it needs a date as input and it does disable ARRR and enable it back with that date sync param set and on activation after a restart of the app no date param is passed

smk762 commented 10 months ago

Issue solved at api level and with block height calc logic generalized to nearest 1000