[Cashtab] [p7 of 8] Only hydrate changed utxos
Summary:
T1683
This diff introduces the first working version of this feature.
Currently, this diff includes many console.log statements and has also reduced the refresh rate by a factor of 10. This is for testing purposes -- before this diff is landed, the comments will be removed, and refresh rate will be left unchanged (to be modified in its own diff).
However, I'll leave it there until we get to the end of this series of diffs -- then pull it out if it is not used.
X Add function isExcludedUtxo with unit tests (determines if a given utxo is in an array of utxos)
X Add function whichUtxosWereAdded with unit tests
X Add function whichUtxosWereRemoved with unit tests
X Add function addNewHydratedUtxos with unit tests
X Add function removeConsumedUtxos with unit tests
X Add function areAllUtxosIncludedInIncrementallyHydratedUtxos with unit tests
X Using the above functions, modify the update function in useBCH.js to only hydrate (that is, collect eToken info about) the utxos that changed since the last time update ran
_ Reduce the interval between calls to update, speeding up Cashtab refresh rate
Current state of Cashtab:
hydratedUtxoDetails is recreated each time the utxo set changes. This requires a series of slow API calls to SLPDB.
Cashtab after this series of diffs lands:
Only new incoming utxos are parsed by API calls to SLPDB. These are added to hydratedUtxoDetails. Consumed utxos are removed. The resulting hydratedUtxoDetails is then validated to ensure it includes all utxos in the wallet. In testing, this reduces Cashtab UI locktime after sending a tx by about 60%.
Test Plan: Send and receive all kinds of transactions. Try to do it quickly and break it. eTokens, multi-send, send and receive, the works. Create new wallets. Do the same thing. Rename wallets. Change between wallets.
Reviewers: #bitcoin_abc, emack
Reviewed By: #bitcoin_abc, emack
Subscribers: emack
Differential Revision: https://reviews.bitcoinabc.org/D11107