@@ -757,7 +757,7 @@ static struct io_plan *init_hsm(struct io_conn *conn,
757757 "proxy_%s error: %s" , __FUNCTION__ ,
758758 proxy_last_message ());
759759 }
760- g_proxy_impl = PROXY_IMPL_MARSHALED ;
760+ g_proxy_impl = PROXY_IMPL_IGNORE ;
761761
762762 /*~ We don't need the hsm_secret encryption key anymore.
763763 * Note that sodium_munlock() also zeroes the memory. */
@@ -1021,7 +1021,7 @@ static struct io_plan *handle_sign_commitment_tx(struct io_conn *conn,
10211021 return bad_req_fmt (conn , c , msg_in ,
10221022 "proxy_%s error: %s" , __FUNCTION__ ,
10231023 proxy_last_message ());
1024- g_proxy_impl = PROXY_IMPL_MARSHALED ;
1024+ g_proxy_impl = PROXY_IMPL_COMPLETE ;
10251025
10261026 return req_reply (conn , c ,
10271027 take (towire_hsm_sign_commitment_tx_reply (NULL , & sig )));
@@ -1171,7 +1171,7 @@ static struct io_plan *handle_sign_delayed_payment_to_us(struct io_conn *conn,
11711171 return bad_req_fmt (conn , c , msg_in ,
11721172 "proxy_%s error: %s" , __FUNCTION__ ,
11731173 proxy_last_message ());
1174- g_proxy_impl = PROXY_IMPL_MARSHALED ;
1174+ g_proxy_impl = PROXY_IMPL_COMPLETE ;
11751175
11761176 return req_reply (conn , c , take (towire_hsm_sign_tx_reply (NULL , & sig )));
11771177}
@@ -1656,13 +1656,12 @@ static struct io_plan *handle_sign_withdrawal_tx(struct io_conn *conn,
16561656 cast_const2 (const struct utxo * * , utxos ), outputs ,
16571657 & changekey , change_out , NULL , NULL , nlocktime );
16581658
1659- /* FIXME - There are two things we can't do remotely yet:
1660- * 1. Handle P2SH inputs.
1659+ /* FIXME - There are things we can't do remotely yet:
16611660 * 2. Handle inputs w/ close_info.
16621661 */
16631662 bool demure = false;
16641663 for (size_t ii = 0 ; ii < tx -> wtx -> num_inputs ; ii ++ )
1665- if (utxos [ii ]-> is_p2sh || utxos [ ii ] -> close_info )
1664+ if (utxos [ii ]-> close_info )
16661665 demure = true;
16671666
16681667 if (!demure ) {
@@ -1690,6 +1689,16 @@ static struct io_plan *handle_sign_withdrawal_tx(struct io_conn *conn,
16901689 const struct utxo * in = utxos [ii ];
16911690 hsm_key_for_utxo (NULL , & inkey , in );
16921691 pubkey_to_der (der_pubkey , & inkey );
1692+
1693+ if (in -> is_p2sh ) {
1694+ u8 * script = bitcoin_scriptsig_p2sh_p2wpkh (
1695+ tx , & inkey );
1696+ bitcoin_tx_input_set_script (tx , ii , script );
1697+
1698+ } else {
1699+ bitcoin_tx_input_set_script (tx , ii , NULL );
1700+ }
1701+
16931702 u8 * * witness = tal_arr (tx , u8 * , 2 );
16941703 witness [0 ] = tal_dup_arr (witness , u8 ,
16951704 sigs [ii ],
0 commit comments