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:
- 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.
- Document the workflow rather than embedding the logic into
TxBuilder.
- 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.
Description
TxBuilder::add_foreign_utxoallows 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
LocalUtxosbecause theKeychainTxOutIndexfilters out any outpoint not related to a script pubkey produced by theKeyChain.Something that may be needed though in
Walletis a method to insert transactions, as the only available now isinsert_txoutbut 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:Wallet.insert_txoutfromTxBuilder.add_foreign_utxoto make this less manual, but I think is going to make the API much more entangled to what I would like.TxBuilder.TxBuilder.add_foreign_utxoif the UTXO is not listed there, forcing the TxBuilder API user to callWallet.insert_transactionorWallet.insert_txoutbefore callingTxBuilder.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.