Closed torkelrogstad closed 2 days ago
In the bip300301_wallet
implementation add_foreign_utxo
works like this:
builder
.add_foreign_utxo(
ctip_outpoint,
bitcoin::psbt::Input {
non_witness_utxo: Some(transaction),
..bitcoin::psbt::Input::default()
},
0,
)
.into_diagnostic()?;
I am not sure how to get the value for satisfaction_weight
either.
Here is the documentation for the function:
https://docs.rs/bdk/latest/bdk/wallet/tx_builder/struct.TxBuilder.html#method.add_foreign_utxo
satisfaction_weight: To know how much weight/vbytes the input will add to the transaction for fee calculation.
If I understand this correctly it is the weight of the script that will satisfy the scriptPubKey
of the input.
The treasury UTXO is an anyone can spend, so I think setting satisfaction_weight
to 0 would make sense. It did work for bip300301_wallet
implementation, though it would make sense to double check this, or at least add a comment like "// Setting this to 0 might be wrong".
Thanks @nchashch! Appreciate it
Thanks @nchashch! Appreciate it
Here is the actual implementation in bip300301_wallet
:
https://github.com/LayerTwo-Labs/bip300301_wallet/blob/master/src/wallet.rs#L749
~This is currently not working.~
~I'm not sure how to add the previous Ctip to the OP_DRIVECHAIN TX. I'm using
add_foreign_utxo
, but don't know how to obtain thepsbt_input
andsatisfaction_weight
values to pass in as parameters to that method. ~~I'm able to create a transaction, but having some issues with both broadcasting as well as adding the previous Ctip for the sidechain.~
Update: was able to broadcast the TX, with help from @CryptAxe . Was missing the
acceptnonstdtxn
parameter for my local Core node. Updated the README.Example of a created transaction:
This decodes to: