mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +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);
|
const tal_t *tmpctx = tal_tmpctx(master);
|
||||||
u64 satoshi_out, change_out;
|
u64 satoshi_out, change_out;
|
||||||
u32 change_keyindex;
|
u32 change_keyindex;
|
||||||
struct bitcoin_address destination;
|
|
||||||
struct utxo *utxos;
|
struct utxo *utxos;
|
||||||
secp256k1_ecdsa_signature *sigs;
|
secp256k1_ecdsa_signature *sigs;
|
||||||
u8 *wscript;
|
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,
|
if (!fromwire_hsm_sign_withdrawal(tmpctx, msg, NULL, &satoshi_out,
|
||||||
&change_out, &change_keyindex,
|
&change_out, &change_keyindex,
|
||||||
destination.addr.u.u8, &utxos)) {
|
&scriptpubkey, &utxos)) {
|
||||||
status_trace("Failed to parse sign_withdrawal: %s",
|
status_trace("Failed to parse sign_withdrawal: %s",
|
||||||
tal_hex(trc, msg));
|
tal_hex(trc, msg));
|
||||||
return;
|
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);
|
pubkey_from_der(ext.pub_key, sizeof(ext.pub_key), &changekey);
|
||||||
scriptpubkey = scriptpubkey_p2pkh(tmpctx, &destination);
|
|
||||||
tx = withdraw_tx(
|
tx = withdraw_tx(
|
||||||
tmpctx, to_utxoptr_arr(tmpctx, utxos), scriptpubkey, satoshi_out,
|
tmpctx, to_utxoptr_arr(tmpctx, utxos), scriptpubkey, satoshi_out,
|
||||||
&changekey, change_out, NULL);
|
&changekey, change_out, NULL);
|
||||||
|
@ -51,7 +51,8 @@ hsm_sign_withdrawal,7
|
|||||||
hsm_sign_withdrawal,,satoshi_out,u64
|
hsm_sign_withdrawal,,satoshi_out,u64
|
||||||
hsm_sign_withdrawal,,change_out,u64
|
hsm_sign_withdrawal,,change_out,u64
|
||||||
hsm_sign_withdrawal,,change_keyindex,u32
|
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,,num_inputs,u16
|
||||||
hsm_sign_withdrawal,,inputs,num_inputs*struct utxo
|
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");
|
command_fail(cmd, "Could not parse destination address");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
withdraw->destination
|
||||||
|
= scriptpubkey_p2pkh(withdraw, &p2pkh_destination);
|
||||||
|
|
||||||
/* Check address given is compatible with the chain we are on. */
|
/* Check address given is compatible with the chain we are on. */
|
||||||
if (testnet != get_chainparams(cmd->ld)->testnet) {
|
if (testnet != get_chainparams(cmd->ld)->testnet) {
|
||||||
@ -148,7 +150,7 @@ static void json_withdraw(struct command *cmd,
|
|||||||
withdraw->amount,
|
withdraw->amount,
|
||||||
withdraw->changesatoshi,
|
withdraw->changesatoshi,
|
||||||
withdraw->change_key_index,
|
withdraw->change_key_index,
|
||||||
p2pkh_destination.addr.u.u8,
|
withdraw->destination,
|
||||||
utxos);
|
utxos);
|
||||||
tal_free(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);
|
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,
|
tx = withdraw_tx(withdraw, withdraw->utxos, withdraw->destination,
|
||||||
withdraw->amount, &changekey, withdraw->changesatoshi,
|
withdraw->amount, &changekey, withdraw->changesatoshi,
|
||||||
cmd->ld->wallet->bip32_base);
|
cmd->ld->wallet->bip32_base);
|
||||||
|
Loading…
Reference in New Issue
Block a user