@ -455,9 +455,10 @@ enum onion_type send_htlc_out(struct channel *out,
struct htlc_in * in ,
struct htlc_in * in ,
struct htlc_out * * houtp )
struct htlc_out * * houtp )
{
{
struct htlc_out * hout ;
u8 * msg ;
u8 * msg ;
* houtp = NULL ;
if ( ! channel_can_add_htlc ( out ) ) {
if ( ! channel_can_add_htlc ( out ) ) {
log_info ( out - > log , " Attempt to send HTLC but not ready (%s) " ,
log_info ( out - > log , " Attempt to send HTLC but not ready (%s) " ,
channel_state_name ( out ) ) ;
channel_state_name ( out ) ) ;
@ -477,10 +478,10 @@ enum onion_type send_htlc_out(struct channel *out,
}
}
/* Make peer's daemon own it, catch if it dies. */
/* Make peer's daemon own it, catch if it dies. */
hout = new_htlc_out ( out - > owner , out , amount , cltv ,
* houtp = new_htlc_out ( out - > owner , out , amount , cltv ,
payment_hash , onion_routing_packet , in = = NULL ,
payment_hash , onion_routing_packet , in = = NULL ,
partid , in ) ;
partid , in ) ;
tal_add_destructor ( hout , destroy_hout_subd_died ) ;
tal_add_destructor ( * houtp , destroy_hout_subd_died ) ;
/* Give channel 30 seconds to commit (first) htlc. */
/* Give channel 30 seconds to commit (first) htlc. */
if ( ! out - > htlc_timeout & & ! IFDEV ( out - > peer - > ld - > dev_no_htlc_timeout , 0 ) )
if ( ! out - > htlc_timeout & & ! IFDEV ( out - > peer - > ld - > dev_no_htlc_timeout , 0 ) )
@ -490,10 +491,9 @@ enum onion_type send_htlc_out(struct channel *out,
out ) ;
out ) ;
msg = towire_channel_offer_htlc ( out , amount , cltv , payment_hash ,
msg = towire_channel_offer_htlc ( out , amount , cltv , payment_hash ,
onion_routing_packet ) ;
onion_routing_packet ) ;
subd_req ( out - > peer - > ld , out - > owner , take ( msg ) , - 1 , 0 , rcvd_htlc_reply , hout ) ;
subd_req ( out - > peer - > ld , out - > owner , take ( msg ) , - 1 , 0 , rcvd_htlc_reply ,
* houtp ) ;
if ( houtp )
* houtp = hout ;
return 0 ;
return 0 ;
}
}
@ -593,13 +593,6 @@ static void forward_htlc(struct htlc_in *hin,
if ( ! failcode )
if ( ! failcode )
return ;
return ;
/* In fact, we didn't get the new htlc_out in these 2 cases */
if ( failcode = = WIRE_UNKNOWN_NEXT_PEER | |
failcode = = WIRE_TEMPORARY_CHANNEL_FAILURE ) {
tal_free ( hout ) ;
hout = NULL ;
}
fail :
fail :
local_fail_htlc ( hin , failcode , next - > scid ) ;
local_fail_htlc ( hin , failcode , next - > scid ) ;
wallet_forwarded_payment_add ( ld - > wallet ,
wallet_forwarded_payment_add ( ld - > wallet ,