Page MenuHomePhabricator

[Cashtab] [chronik tx history p20] update token info cache in tx history routine
ClosedPublic

Authored by bytesofman on Oct 5 2022, 22:20.

Details

Summary

T2447

Depends on D12148

Update token info cache in tx history

I thought this wouldn't be necessary because the token info cache is updated by utxos immediately before tx history is called. However, I fortunately discovered an edge case. You can have a situation where

  1. Cashtab user in Cashtab wallet Alpha in browser Alpha receives eToken Alpha
  2. Cashtab user in Cashtab wallet Alpha in browser Alpha burns eToken Alpha or sends it away
  3. Cashtab user opens Cashtab wallet Alpha in browser Beta. Now that etoken is not in the wallet utxos nor is it in cache of browser Beta. But it's in the tx history. If this isn't handled, it will never be added to cache, and the tx history will not have token decimals, so it will be rendered incorrectly.

This diff uses a similar approach to that used in the chronik utxo implementation.

Test Plan

Review code changes
Execute the steps above (1, 2, 3)
Check the dev console to verify that Uncached token info found in tx history, adding to cache appears and the token txs are rendered correctly in tx history after ~10 seconds

Diff Detail

Repository
rABC Bitcoin ABC
Branch
chronik-for-tx-history-stack
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 20371
Build 40415: Build Diffcashtab-tests
Build 40414: arc lint + arc unit