Skip to content

Redesign TxBuilder #164

Open
Open
@evanlinjin

Description

@evanlinjin

Description

We can design a more intuitive transaction-building flow by splitting tx-building into the follow stages:

  1. Coin Control
    • Determine which coins can be candidates, and which coins to filter out.
    • Determine coin groups (which coins must be spent together, and which coins must NOT be spent together).
    • Add plan to each coin (from planning module).
  2. Coin Selection
    • Select coins for the actual transaction.
    • Determine whether we need a drain output (change policy).
  3. Transaction Finalization
    • Formulate unsigned transaction.
    • Reordering/shuffling of inputs/outputs.
  4. PSBT Preparation
    • Maps the candidates chosen by coin selection to their plans and uses the plan to create the PSBT input.
    • Maps the outputs (including drain if exists) into the PSBT.
  5. Signing

Implementation Details

  • For "must be spent together", group them somehow like: Vec<(Plan, TxOut, OutPoint)>.

Related

Metadata

Metadata

Labels

new featureNew feature or request

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions