Page MenuHomePhabricator

[Cashtab] [Chronik] [Tx Gen] Generate Tx Input
AbandonedPublic

Authored by emack on Jun 18 2022, 06:15.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Summary

As per T2503, this is part of a series of diffs to refactor the transaction generation process within useBCH.

This diff is a standalone utility function which collates enough utxos for the active wallet to cover the sats being sent in an XEC tx and adds each utxo as an input onto the transaction builder instance and inputUtxos array, including fee calculation.

The function returns an object containing the transaction builder instance, the originalAmount (total utxo values), txFee and inputUtxos array.

Test Plan

npm test
observe successful execution of generateTxInput() unit tests

Diff Detail

Repository
rABC Bitcoin ABC
Branch
generateTxInput
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 19415
Build 38563: Build Diffcashtab-tests
Build 38562: arc lint + arc unit

Event Timeline

emack requested review of this revision.Jun 18 2022, 06:15

Added inputUtxos and txFee to the txInputObj returned from this function as they are inputs for the subsequent call to generateTxOutput().

bytesofman added inline comments.
web/cashtab/package.json
94

Should not need this; at any rate it is unrelated to this diff

web/cashtab/src/hooks/useBCH.js
1405

Is originalAmount really an input?

1431

This has always been a confusing parameter. It's not clear what originalAmount is from the variable name. It has persisted as an artifact from legacy BCH examples.

Let's change this variable to better describe what it is, say totalInputUtxoValue

This revision now requires changes to proceed.Jun 20 2022, 18:23
emack marked 3 inline comments as done.

To be resubmitted as a fresh diff due to --skip-worktree issues