HomePhabricator

[Cashtab] Cache wallet state in indexedDb

Description

[Cashtab] Cache wallet state in indexedDb

Summary:
This is the first step toward caching bcha utxos, slpa utxos, and tx history in local storage.

Currently the largest bottleneck on the server is that the web wallet must poll the server for full utxo history on startup. If state is saved to local storage, then Cashtab can instead only poll for utxo changes, and then only poll changed utxos for SLPA status.

This change does not add utxos or txhistory to state. It only adds what is already stored in state to the cache. Future diffs will add info required for caching, check for state in storage before polling the server, and reduce server calls from all utxos on every startup to only required calls for uncached utxo data.

Test Plan:

  1. npm start
  2. Observe in dev console that state is saved to the wallet object.
  3. Confirm in dev console under Application --> IndexedDb that the wallet object has been saved with new state parameter.
  4. Activate a different wallet.
  5. Confirm that your previously active wallet was written to savedWallets in IndexedDb with state parameter.

There are no unit tests for this diff because the app is designed to work whether or not state has been saved. A unit test mocking localForage does not add anything; equivalent to saying "expect true to be true."

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D9400

Details

Provenance
Joey King <joseph.roy.king@gmail.com>Authored on Apr 13 2021, 16:55
bytesofmanPushed on Apr 14 2021, 17:58
Reviewer
Restricted Project
Differential Revision
D9400: [Cashtab] Cache wallet state in indexedDb
Parents
rABC1ac19f622869: [BUILDBOT] Switch secp256k1 to Cirrus CI
Branches
Unknown
Tags
Unknown

Event Timeline