Skip to content

Inform wallet about foreign transactions/txouts before using them to fund new transactions #345

@nymius

Description

@nymius

Description

This is a follow up of #337 and #325

TxBuilder::add_foreign_utxo allows the construction of transactions with UTXOs not belonging to the wallet.
Trying to RBF those transactions up to #337 failed.
#337 is relying on the manual addition of the UTXOs to the transaction graph.
The wallet is not going to list them them as LocalUtxos because the KeychainTxOutIndex filters out any outpoint not related to a script pubkey produced by the KeyChain.

Something that may be needed though in Wallet is a method to insert transactions, as the only available now is insert_txout but for non segwit foreign UTXOs the full transaction will be needed at the moment of building the tx RBF.

To address the original issue from the perspective of TxBuilder, I had three options so far:

  1. Calling Wallet.insert_txout from TxBuilder.add_foreign_utxo to make this less manual, but I think is going to make the API much more entangled to what I would like.
  2. Document the workflow rather than embedding the logic into TxBuilder.
  3. Add a method to list non local UTXOs to wallet or tx graph and error in TxBuilder.add_foreign_utxo if the UTXO is not listed there, forcing the TxBuilder API user to call Wallet.insert_transaction or Wallet.insert_txout before calling TxBuilder.add_foreign_utxo.

I think the third one is preferable, but I'm writing this issue to gather feedback and see if there are any concerns I"m overlooking.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Discussion

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions