@@ -588,6 +588,7 @@ static enum channel_add_err add_htlc(struct channel *channel,
588588 struct htlc * * htlcp ,
589589 bool enforce_aggregate_limits ,
590590 struct amount_sat * htlc_fee ,
591+ struct tlv_field * extra_tlvs ,
591592 bool err_immediate_failures )
592593{
593594 struct htlc * htlc , * old ;
@@ -613,6 +614,15 @@ static enum channel_add_err add_htlc(struct channel *channel,
613614 htlc -> failed = NULL ;
614615 htlc -> r = NULL ;
615616 htlc -> routing = tal_dup_arr (htlc , u8 , routing , TOTAL_PACKET_SIZE (ROUTING_INFO_SIZE ), 0 );
617+ if (extra_tlvs && tal_count (extra_tlvs ) > 0 ) {
618+ htlc -> extra_tlvs = tal_dup_talarr (htlc , struct tlv_field , extra_tlvs );
619+ for (size_t i = 0 ; i < tal_count (extra_tlvs ); i ++ ) {
620+ /* We need to attach the value to the correct parent */
621+ htlc -> extra_tlvs [i ].value = tal_dup_talarr (htlc , u8 , htlc -> extra_tlvs [i ].value );
622+ }
623+ } else {
624+ htlc -> extra_tlvs = NULL ;
625+ }
616626
617627 /* FIXME: Change expiry to simple u32 */
618628
@@ -905,6 +915,7 @@ enum channel_add_err channel_add_htlc(struct channel *channel,
905915 const struct pubkey * path_key TAKES ,
906916 struct htlc * * htlcp ,
907917 struct amount_sat * htlc_fee ,
918+ struct tlv_field * extra_tlvs ,
908919 bool err_immediate_failures )
909920{
910921 enum htlc_state state ;
@@ -923,7 +934,7 @@ enum channel_add_err channel_add_htlc(struct channel *channel,
923934
924935 return add_htlc (channel , state , id , amount , cltv_expiry ,
925936 payment_hash , routing , path_key ,
926- htlcp , true, htlc_fee , err_immediate_failures );
937+ htlcp , true, htlc_fee , extra_tlvs , err_immediate_failures );
927938}
928939
929940struct htlc * channel_get_htlc (struct channel * channel , enum side sender , u64 id )
@@ -1621,7 +1632,7 @@ bool channel_force_htlcs(struct channel *channel,
16211632 & htlcs [i ]-> payment_hash ,
16221633 htlcs [i ]-> onion_routing_packet ,
16231634 htlcs [i ]-> path_key ,
1624- & htlc , false, NULL , false);
1635+ & htlc , false, NULL , NULL , false);
16251636 if (e != CHANNEL_ERR_ADD_OK ) {
16261637 status_broken ("%s HTLC %" PRIu64 " failed error %u" ,
16271638 htlc_state_owner (htlcs [i ]-> state ) == LOCAL
0 commit comments