mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 18:57:06 +01:00
devtools: print witnesses along with signatures for mkfunding
we need the witnesses for dual-funding transactions
This commit is contained in:
parent
913a1a9b59
commit
abcde461df
1 changed files with 7 additions and 3 deletions
|
@ -47,6 +47,7 @@ int main(int argc, char *argv[])
|
||||||
struct bitcoin_signature sig;
|
struct bitcoin_signature sig;
|
||||||
struct bitcoin_txid txid;
|
struct bitcoin_txid txid;
|
||||||
const struct chainparams *chainparams = chainparams_for_network("bitcoin");
|
const struct chainparams *chainparams = chainparams_for_network("bitcoin");
|
||||||
|
u8 **witnesses;
|
||||||
|
|
||||||
setup_locale();
|
setup_locale();
|
||||||
|
|
||||||
|
@ -116,8 +117,14 @@ int main(int argc, char *argv[])
|
||||||
sign_tx_input(tx, 0, NULL, p2wpkh_scriptcode(NULL, &inputkey),
|
sign_tx_input(tx, 0, NULL, p2wpkh_scriptcode(NULL, &inputkey),
|
||||||
&input_privkey, &inputkey,
|
&input_privkey, &inputkey,
|
||||||
SIGHASH_ALL, &sig);
|
SIGHASH_ALL, &sig);
|
||||||
|
witnesses = bitcoin_witness_p2wpkh(NULL, &sig, &inputkey);
|
||||||
|
bitcoin_tx_input_set_witness(tx, 0, witnesses);
|
||||||
|
|
||||||
printf("# funding sig: %s\n", sig_as_hex(&sig));
|
printf("# funding sig: %s\n", sig_as_hex(&sig));
|
||||||
|
printf("# funding witnesses: [\n");
|
||||||
|
for (size_t i = 0; i < tal_count(witnesses); i++)
|
||||||
|
printf("\t%s\n", tal_hex(NULL, witnesses[i]));
|
||||||
|
printf("# ]\n");
|
||||||
printf("# funding amount: %s\n",
|
printf("# funding amount: %s\n",
|
||||||
type_to_string(NULL, struct amount_sat, &funding_amount));
|
type_to_string(NULL, struct amount_sat, &funding_amount));
|
||||||
|
|
||||||
|
@ -125,9 +132,6 @@ int main(int argc, char *argv[])
|
||||||
printf("# funding txid: %s\n",
|
printf("# funding txid: %s\n",
|
||||||
type_to_string(NULL, struct bitcoin_txid, &txid));
|
type_to_string(NULL, struct bitcoin_txid, &txid));
|
||||||
|
|
||||||
bitcoin_tx_input_set_witness(
|
|
||||||
tx, 0, bitcoin_witness_p2wpkh(NULL, &sig, &inputkey));
|
|
||||||
|
|
||||||
printf("tx: %s\n", tal_hex(NULL, linearize_tx(NULL, tx)));
|
printf("tx: %s\n", tal_hex(NULL, linearize_tx(NULL, tx)));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue