HomePhabricator

[Cashtab] Only add inputs to a tx if you need them

Description

[Cashtab] Only add inputs to a tx if you need them

Summary:
NFT support will introduce the first txs in Cashtab with a required input that is not a token input.

Generalize the sendXec function to accept requiredInputs as a param (really, just renaming tokenInputs).

Because the agora input includes XEC, the tx will typically not require additional utxos. Refactor sendXec so that we do not add utxos if we already have sufficient utxos for the tx.

In implementing this refactor, discovered it is also an optimization -- some burn txs will have enough utxos from token dust inputs and will not need an additional non-SLP utxo.

Update these burn tests. Add a new test for edge case where sendXec tries to build and broadcast a tx but needs to add another utxo to cover fee.

Test Plan: npm test

Reviewers: #bitcoin_abc, emack

Reviewed By: #bitcoin_abc, emack

Subscribers: emack

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

Details

Provenance
bytesofmanAuthored on Jul 9 2024, 20:25
bytesofmanPushed on Jul 10 2024, 16:43
Reviewer
Restricted Project
Differential Revision
D16436: [Cashtab] Only add inputs to a tx if you need them
Parents
rABC3fe72d4b1ede: [Cashtab] Update comment and TODO in sendXec function
Branches
Unknown
Tags
Unknown