HomePhabricator

[Cashtab] Do not throw API error utxo with null isValid

Description

[Cashtab] Do not throw API error utxo with null isValid

Summary:
T1920 related

Recently dev work has been going on to send and parse OP_RETURN transactions with Cashtab. However, during this work, we've learned that bch-api (through SLPDB) is confused by transactions with OP_RETURN msgs that are not eToken txs. Specifically, the validation function will return null.

Because SLPDB will also return isValid: null when the backend is rate limited, the old behavior of Cashtab threw an error that would change the API or lock the app until the API was not rate limited. However, in this case the issue is not a rate limit. So, if a user has a utxo with a normal OP_RETURN msg in it...Cashtab will perpetually throw a rate limit error.

This diff corrects this behavior. Cashtab already filters out isValid: null utxos from the utxo set (lines 434 and 443 of useBCH.js).

Future diffs will parse these utxos appropriately. However, since neither SLPDB nor bch-api do this, will be a bit complicated; probably screening OP_RETURN fields for SLP prefixes.

Test Plan:
arc patch d10363 and npm start to run a branch of cashtab that will allow you to send yourself an OP_RETURN tx (alt: send your cashtab wallet an OP_RETURN msg tx)
Note that the wallet throws an API error and never recovers
arc patch D10368 and npm start
Note that wallet recovers, though the null utxo is logged to console

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: emack, Fabien

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

Details

Provenance
Joey King <joseph.roy.king@gmail.com>Authored on Oct 19 2021, 20:34
bytesofmanPushed on Oct 22 2021, 12:52
Reviewer
Restricted Project
Differential Revision
D10368: [Cashtab] Do not throw API error utxo with null isValid
Parents
rABC5c884d7f2992: Bump version to 0.24.5
Branches
Unknown
Tags
Unknown