GoodDollar / GoodDAPP

GoodDollar.org Wallet is the simplest access point to Claim your daily G$. It Is based on web3 and React native web.
good-dapp.vercel.app
MIT License
108 stars 55 forks source link

Optimize scanning transactions & other contract events #3668

Closed johnsmith-gooddollar closed 2 years ago

johnsmith-gooddollar commented 2 years ago
roma-hladilka commented 2 years ago

@sirpy now last block is stored in user storage and updates on every poll. Do we need some additional changes?

sirpy commented 2 years ago

@roma-hladilka no. I believe there's a bug that the TX scanning starts before we sync the user properties from the database so we need to verify we await for the userStorage init before we trigger the scanning

alt-a1r commented 2 years ago

@sirpy Regarding the previous comment, a check has now been added to wait for user properties to be initialized before the initTransferEvents action.

Regarding the third point, now the rescan occurs when the dashboard component is mounted, perhaps it makes sense to leave it in this way, since we need an update every time the dashboard is mounted?

johnsmith-gooddollar commented 2 years ago

@sirpy the comment above is about pt3. "perform the rescan only when user app goes to background"

Could you please describe in details what did you meant here ? What's the idea and goals of this change ? How it should actually working?

sirpy commented 2 years ago

the idea is to to reset or move backwards the lastBlock variable so blocks will be rescanned in case some block was missed, but I dont think it is necessary at the moment.