@@ -998,15 +998,12 @@ static struct io_plan *handle_sign_commitment_tx(struct io_conn *conn,
998998 struct client * c ,
999999 const u8 * msg_in )
10001000{
1001- struct pubkey remote_funding_pubkey , local_funding_pubkey ;
1001+ struct pubkey remote_funding_pubkey ;
10021002 struct node_id peer_id ;
10031003 u64 dbid ;
10041004 struct amount_sat funding ;
1005- struct secret channel_seed ;
10061005 struct bitcoin_tx * tx ;
10071006 struct bitcoin_signature sig ;
1008- struct secrets secrets ;
1009- const u8 * funding_wscript ;
10101007
10111008 if (!fromwire_hsm_sign_commitment_tx (tmpctx , msg_in ,
10121009 & peer_id , & dbid ,
@@ -1032,9 +1029,7 @@ static struct io_plan *handle_sign_commitment_tx(struct io_conn *conn,
10321029 tx -> input_amounts [0 ] = tal_dup (tx , struct amount_sat , & funding );
10331030
10341031 proxy_stat rv = proxy_handle_sign_commitment_tx (
1035- tx , & remote_funding_pubkey , & funding ,
1036- & c -> id , c -> dbid ,
1037- & sig );
1032+ tx , & remote_funding_pubkey , & peer_id , dbid , & sig );
10381033 if (PROXY_PERMANENT (rv ))
10391034 status_failed (STATUS_FAIL_INTERNAL_ERROR ,
10401035 "proxy_%s failed: %s" , __FUNCTION__ ,
@@ -1045,28 +1040,6 @@ static struct io_plan *handle_sign_commitment_tx(struct io_conn *conn,
10451040 proxy_last_message ());
10461041 g_proxy_impl = PROXY_IMPL_MARSHALED ;
10471042
1048- #if 0
1049- status_debug ("%s:%d %s: signature: %s" ,
1050- __FILE__ , __LINE__ , __FUNCTION__ ,
1051- type_to_string (tmpctx , struct bitcoin_signature , & sig ));
1052- #else
1053- get_channel_seed (& peer_id , dbid , & channel_seed );
1054- derive_basepoints (& channel_seed ,
1055- & local_funding_pubkey , NULL , & secrets , NULL );
1056-
1057- /*~ Bitcoin signatures cover the (part of) the script they're
1058- * executing; the rules are a bit complex in general, but for
1059- * Segregated Witness it's simply the current script. */
1060- funding_wscript = bitcoin_redeem_2of2 (tmpctx ,
1061- & local_funding_pubkey ,
1062- & remote_funding_pubkey );
1063- sign_tx_input (tx , 0 , NULL , funding_wscript ,
1064- & secrets .funding_privkey ,
1065- & local_funding_pubkey ,
1066- SIGHASH_ALL ,
1067- & sig );
1068- #endif
1069-
10701043 return req_reply (conn , c ,
10711044 take (towire_hsm_sign_commitment_tx_reply (NULL , & sig )));
10721045}
@@ -1436,13 +1409,10 @@ static struct io_plan *handle_sign_mutual_close_tx(struct io_conn *conn,
14361409 struct client * c ,
14371410 const u8 * msg_in )
14381411{
1439- struct secret channel_seed ;
14401412 struct bitcoin_tx * tx ;
1441- struct pubkey remote_funding_pubkey , local_funding_pubkey ;
1413+ struct pubkey remote_funding_pubkey ;
14421414 struct bitcoin_signature sig ;
1443- struct secrets secrets ;
14441415 struct amount_sat funding ;
1445- const u8 * funding_wscript ;
14461416
14471417 if (!fromwire_hsm_sign_mutual_close_tx (tmpctx , msg_in ,
14481418 & tx ,
@@ -1456,9 +1426,7 @@ static struct io_plan *handle_sign_mutual_close_tx(struct io_conn *conn,
14561426 tx -> input_amounts [0 ] = tal_dup (tx , struct amount_sat , & funding );
14571427
14581428 proxy_stat rv = proxy_handle_sign_mutual_close_tx (
1459- tx , & remote_funding_pubkey , & funding ,
1460- & c -> id , c -> dbid ,
1461- & sig );
1429+ tx , & remote_funding_pubkey , & c -> id , c -> dbid , & sig );
14621430 if (PROXY_PERMANENT (rv ))
14631431 status_failed (STATUS_FAIL_INTERNAL_ERROR ,
14641432 "proxy_%s failed: %s" , __FUNCTION__ ,
@@ -1467,25 +1435,7 @@ static struct io_plan *handle_sign_mutual_close_tx(struct io_conn *conn,
14671435 return bad_req_fmt (conn , c , msg_in ,
14681436 "proxy_%s error: %s" , __FUNCTION__ ,
14691437 proxy_last_message ());
1470- /* FIXME - uncomment this: assert(tal_count(sigs) == 1); */
1471- g_proxy_impl = PROXY_IMPL_MARSHALED ;
1472-
1473- /* FIXME - USE SERVER RESULT AND REMOVE BELOW */
1474-
1475- /* FIXME: We should know dust level, decent fee range and
1476- * balances, and final_keyindex, and thus be able to check tx
1477- * outputs! */
1478- get_channel_seed (& c -> id , c -> dbid , & channel_seed );
1479- derive_basepoints (& channel_seed ,
1480- & local_funding_pubkey , NULL , & secrets , NULL );
1481-
1482- funding_wscript = bitcoin_redeem_2of2 (tmpctx ,
1483- & local_funding_pubkey ,
1484- & remote_funding_pubkey );
1485- sign_tx_input (tx , 0 , NULL , funding_wscript ,
1486- & secrets .funding_privkey ,
1487- & local_funding_pubkey ,
1488- SIGHASH_ALL , & sig );
1438+ g_proxy_impl = PROXY_IMPL_COMPLETE ;
14891439
14901440 return req_reply (conn , c , take (towire_hsm_sign_tx_reply (NULL , & sig )));
14911441}
0 commit comments