HomePhabricator

[Cashtab] Improve input-collecting functions for Agora partial accept and…

Description

[Cashtab] Improve input-collecting functions for Agora partial accept and cancel txs

Summary:
Initially, the function getAgoraPartialFuelInput was used to get the required fuel inputs for canceling or accepting an agora partial tx. This was a simplified function that would only return 1 utxo.

For the cancel feature, this simplification was ok (though still lazy) --- because canceling a tx only requires a tx fee, usually less than 1,000 satoshis. In this case, users will almost always have a utxo large enough to cover the tx (if their balance is large enough).

This same assumption would be rarely true for accepting partial txs though. Accept txs must pay for tokens and cover the fee. Paying for tokens can be almost anything, so we cannot assume the user just has this amount in 1 utxo somewhere.

Drop the lazy approach for a new approach that properly picks inputs. We use a dummy input to estimate the fees.

Complicated to test because we need to create an AgoraOffer object. AgoraOffer objects were created for integration testing Agora accepts and cancels in D16846. We include that mock here, since we use it in this diff, and it makes it easier to see how we build these mocks outside of the very large D16846.

getAgoraPartialFuelInput is deprecated along with its associated tests.

No functions are yet implemented in Cashtab. That is reserved for D16846

Test Plan: npm test

Reviewers: #bitcoin_abc, emack

Reviewed By: #bitcoin_abc, emack

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

Details

Provenance
bytesofmanAuthored on Sat, Oct 19, 22:47
bytesofmanPushed on Sun, Oct 20, 15:15
Reviewer
Restricted Project
Differential Revision
D16942: [Cashtab] Improve input-collecting functions for Agora partial accept and cancel txs
Parents
rABC06513870a6fc: [Cashtab] Patch proptypes for slider
Branches
Unknown
Tags
Unknown