@ -773,7 +773,8 @@ static struct io_plan *handle_sign_commitment_tx(struct io_conn *conn,
* pointer , as we don ' t always know it ( and zero is a valid amount , so
* pointer , as we don ' t always know it ( and zero is a valid amount , so
* NULL is better to mean ' unknown ' and has the nice property that
* NULL is better to mean ' unknown ' and has the nice property that
* you ' ll crash if you assume it ' s there and you ' re wrong . */
* you ' ll crash if you assume it ' s there and you ' re wrong . */
tx - > input [ 0 ] . amount = tal_dup ( tx - > input , struct amount_sat , & funding ) ;
tx - > input_amounts [ 0 ] = tal_dup ( tx - > input , struct amount_sat , & funding ) ;
tx - > input_amounts [ 0 ] = tx - > input_amounts [ 0 ] ;
sign_tx_input ( tx , 0 , NULL , funding_wscript ,
sign_tx_input ( tx , 0 , NULL , funding_wscript ,
& secrets . funding_privkey ,
& secrets . funding_privkey ,
& local_funding_pubkey ,
& local_funding_pubkey ,
@ -818,7 +819,7 @@ static struct io_plan *handle_sign_remote_commitment_tx(struct io_conn *conn,
& local_funding_pubkey ,
& local_funding_pubkey ,
& remote_funding_pubkey ) ;
& remote_funding_pubkey ) ;
/* Need input amount for signing */
/* Need input amount for signing */
tx - > input [ 0 ] . amount = tal_dup ( tx - > input , struct amount_sat , & funding ) ;
tx - > input_amounts [ 0 ] = tal_dup ( tx - > input , struct amount_sat , & funding ) ;
sign_tx_input ( tx , 0 , NULL , funding_wscript ,
sign_tx_input ( tx , 0 , NULL , funding_wscript ,
& secrets . funding_privkey ,
& secrets . funding_privkey ,
& local_funding_pubkey ,
& local_funding_pubkey ,
@ -867,7 +868,7 @@ static struct io_plan *handle_sign_remote_htlc_tx(struct io_conn *conn,
" Failed deriving htlc pubkey " ) ;
" Failed deriving htlc pubkey " ) ;
/* Need input amount for signing */
/* Need input amount for signing */
tx - > input [ 0 ] . amount = tal_dup ( tx - > input , struct amount_sat , & amount ) ;
tx - > input_amounts [ 0 ] = tal_dup ( tx - > input , struct amount_sat , & amount ) ;
sign_tx_input ( tx , 0 , NULL , wscript , & htlc_privkey , & htlc_pubkey ,
sign_tx_input ( tx , 0 , NULL , wscript , & htlc_privkey , & htlc_pubkey ,
SIGHASH_ALL , & sig ) ;
SIGHASH_ALL , & sig ) ;
@ -894,7 +895,7 @@ static struct io_plan *handle_sign_to_us_tx(struct io_conn *conn,
if ( tal_count ( tx - > input ) ! = 1 )
if ( tal_count ( tx - > input ) ! = 1 )
return bad_req_fmt ( conn , c , msg_in , " bad txinput count " ) ;
return bad_req_fmt ( conn , c , msg_in , " bad txinput count " ) ;
tx - > input [ 0 ] . amount = tal_dup ( tx - > input , struct amount_sat , & input_sat ) ;
tx - > input_amounts [ 0 ] = tal_dup ( tx - > input , struct amount_sat , & input_sat ) ;
sign_tx_input ( tx , 0 , NULL , wscript , privkey , & pubkey , SIGHASH_ALL , & sig ) ;
sign_tx_input ( tx , 0 , NULL , wscript , privkey , & pubkey , SIGHASH_ALL , & sig ) ;
return req_reply ( conn , c , take ( towire_hsm_sign_tx_reply ( NULL , & sig ) ) ) ;
return req_reply ( conn , c , take ( towire_hsm_sign_tx_reply ( NULL , & sig ) ) ) ;
@ -1093,7 +1094,7 @@ static struct io_plan *handle_sign_local_htlc_tx(struct io_conn *conn,
return bad_req_fmt ( conn , c , msg_in , " bad txinput count " ) ;
return bad_req_fmt ( conn , c , msg_in , " bad txinput count " ) ;
/* FIXME: Check that output script is correct! */
/* FIXME: Check that output script is correct! */
tx - > input [ 0 ] . amount = tal_dup ( tx - > input , struct amount_sat , & input_sat ) ;
tx - > input_amounts [ 0 ] = tal_dup ( tx - > input , struct amount_sat , & input_sat ) ;
sign_tx_input ( tx , 0 , NULL , wscript , & htlc_privkey , & htlc_pubkey ,
sign_tx_input ( tx , 0 , NULL , wscript , & htlc_privkey , & htlc_pubkey ,
SIGHASH_ALL , & sig ) ;
SIGHASH_ALL , & sig ) ;
@ -1208,7 +1209,7 @@ static struct io_plan *handle_sign_mutual_close_tx(struct io_conn *conn,
& local_funding_pubkey ,
& local_funding_pubkey ,
& remote_funding_pubkey ) ;
& remote_funding_pubkey ) ;
/* Need input amount for signing */
/* Need input amount for signing */
tx - > input [ 0 ] . amount = tal_dup ( tx - > input , struct amount_sat , & funding ) ;
tx - > input_amounts [ 0 ] = tal_dup ( tx - > input , struct amount_sat , & funding ) ;
sign_tx_input ( tx , 0 , NULL , funding_wscript ,
sign_tx_input ( tx , 0 , NULL , funding_wscript ,
& secrets . funding_privkey ,
& secrets . funding_privkey ,
& local_funding_pubkey ,
& local_funding_pubkey ,