mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
Modify hsm_sign_withdrawal to transmit scriptpubkey to withdraw to, rather than pkh.
This commit is contained in:
parent
5fd74f9933
commit
b56fea8b2a
@ -599,7 +599,6 @@ static void sign_withdrawal_tx(struct daemon_conn *master, const u8 *msg)
|
||||
const tal_t *tmpctx = tal_tmpctx(master);
|
||||
u64 satoshi_out, change_out;
|
||||
u32 change_keyindex;
|
||||
struct bitcoin_address destination;
|
||||
struct utxo *utxos;
|
||||
secp256k1_ecdsa_signature *sigs;
|
||||
u8 *wscript;
|
||||
@ -610,7 +609,7 @@ static void sign_withdrawal_tx(struct daemon_conn *master, const u8 *msg)
|
||||
|
||||
if (!fromwire_hsm_sign_withdrawal(tmpctx, msg, NULL, &satoshi_out,
|
||||
&change_out, &change_keyindex,
|
||||
destination.addr.u.u8, &utxos)) {
|
||||
&scriptpubkey, &utxos)) {
|
||||
status_trace("Failed to parse sign_withdrawal: %s",
|
||||
tal_hex(trc, msg));
|
||||
return;
|
||||
@ -624,7 +623,6 @@ static void sign_withdrawal_tx(struct daemon_conn *master, const u8 *msg)
|
||||
}
|
||||
|
||||
pubkey_from_der(ext.pub_key, sizeof(ext.pub_key), &changekey);
|
||||
scriptpubkey = scriptpubkey_p2pkh(tmpctx, &destination);
|
||||
tx = withdraw_tx(
|
||||
tmpctx, to_utxoptr_arr(tmpctx, utxos), scriptpubkey, satoshi_out,
|
||||
&changekey, change_out, NULL);
|
||||
|
@ -51,7 +51,8 @@ hsm_sign_withdrawal,7
|
||||
hsm_sign_withdrawal,,satoshi_out,u64
|
||||
hsm_sign_withdrawal,,change_out,u64
|
||||
hsm_sign_withdrawal,,change_keyindex,u32
|
||||
hsm_sign_withdrawal,,pkh,20*u8
|
||||
hsm_sign_withdrawal,,scriptpubkey_len,u16
|
||||
hsm_sign_withdrawal,,scriptpubkey,scriptpubkey_len*u8
|
||||
hsm_sign_withdrawal,,num_inputs,u16
|
||||
hsm_sign_withdrawal,,inputs,num_inputs*struct utxo
|
||||
|
||||
|
@ -114,6 +114,8 @@ static void json_withdraw(struct command *cmd,
|
||||
command_fail(cmd, "Could not parse destination address");
|
||||
return;
|
||||
}
|
||||
withdraw->destination
|
||||
= scriptpubkey_p2pkh(withdraw, &p2pkh_destination);
|
||||
|
||||
/* Check address given is compatible with the chain we are on. */
|
||||
if (testnet != get_chainparams(cmd->ld)->testnet) {
|
||||
@ -148,7 +150,7 @@ static void json_withdraw(struct command *cmd,
|
||||
withdraw->amount,
|
||||
withdraw->changesatoshi,
|
||||
withdraw->change_key_index,
|
||||
p2pkh_destination.addr.u.u8,
|
||||
withdraw->destination,
|
||||
utxos);
|
||||
tal_free(utxos);
|
||||
|
||||
@ -170,8 +172,6 @@ static void json_withdraw(struct command *cmd,
|
||||
}
|
||||
|
||||
pubkey_from_der(ext.pub_key, sizeof(ext.pub_key), &changekey);
|
||||
withdraw->destination
|
||||
= scriptpubkey_p2pkh(withdraw, &p2pkh_destination);
|
||||
tx = withdraw_tx(withdraw, withdraw->utxos, withdraw->destination,
|
||||
withdraw->amount, &changekey, withdraw->changesatoshi,
|
||||
cmd->ld->wallet->bip32_base);
|
||||
|
Loading…
Reference in New Issue
Block a user