mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
tx-psbt: pass in the witness script (if known) when adding an input
Update the `bitcoin_tx_add_input` interface to accept a witness script and or scriptPubkey. We save the amount + witness script + witness program (if known) to the PSBT object for a transaction when creating an input.
This commit is contained in:
committed by
Christian Decker
parent
a04f0fe250
commit
dc868630a8
@@ -130,10 +130,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
tx = bitcoin_tx(NULL, chainparams, 1, 2, 0);
|
||||
|
||||
/* Our input spends the anchor tx output. */
|
||||
bitcoin_tx_add_input(tx, &funding_txid, funding_outnum,
|
||||
BITCOIN_TX_DEFAULT_SEQUENCE, funding_amount, NULL);
|
||||
|
||||
num_outputs = 0;
|
||||
if (amount_msat_greater_eq_sat(local_msat, dust_limit)) {
|
||||
u8 *script = scriptpubkey_p2wpkh(NULL, &outkey[LOCAL]);
|
||||
@@ -165,6 +161,11 @@ int main(int argc, char *argv[])
|
||||
printf("# funding witness script = %s\n",
|
||||
tal_hex(NULL, funding_wscript));
|
||||
|
||||
/* Our input spends the anchor tx output. */
|
||||
bitcoin_tx_add_input(tx, &funding_txid, funding_outnum,
|
||||
BITCOIN_TX_DEFAULT_SEQUENCE, NULL,
|
||||
funding_amount, NULL, funding_wscript);
|
||||
|
||||
sign_tx_input(tx, 0, NULL, funding_wscript,
|
||||
&funding_privkey[LOCAL],
|
||||
&funding_pubkey[LOCAL],
|
||||
|
||||
Reference in New Issue
Block a user