@@ -176,61 +176,6 @@ u8 *p2wpkh_for_keyidx(const tal_t *ctx, struct lightningd *ld, u64 keyidx)
176176 return scriptpubkey_p2wpkh (ctx , & shutdownkey );
177177}
178178
179- static struct simple_htlc * * collect_htlcs (struct channel * channel , u32 local_feerate ) {
180- // Collect the htlcs for call to hsmd.
181- struct htlc_in_map * htlcs_in = & channel -> peer -> ld -> htlcs_in ;
182- struct htlc_out_map * htlcs_out = & channel -> peer -> ld -> htlcs_out ;
183- struct simple_htlc * * htlcs = tal_arr (tmpctx , struct simple_htlc * , 0 );
184- const int committed_flag = HTLC_FLAG (REMOTE , HTLC_F_COMMITTED );
185-
186- const struct htlc_in * hin ;
187- struct htlc_in_map_iter ini ;
188- for (hin = htlc_in_map_first (htlcs_in , & ini );
189- hin ;
190- hin = htlc_in_map_next (htlcs_in , & ini )) {
191- if (hin -> key .channel != channel )
192- continue ;
193- if (!(htlc_state_flags (hin -> hstate ) & committed_flag ))
194- continue ;
195- if (htlc_is_trimmed (REMOTE , hin -> msat , local_feerate ,
196- channel -> our_config .dust_limit , LOCAL ,
197- channel_has (channel , OPT_ANCHOR_OUTPUTS )))
198- continue ;
199- struct simple_htlc * simple =
200- new_simple_htlc (NULL ,
201- htlc_state_owner (hin -> hstate ),
202- hin -> msat ,
203- & hin -> payment_hash ,
204- hin -> cltv_expiry
205- );
206- tal_arr_expand (& htlcs , tal_steal (htlcs , simple ));
207- }
208-
209- const struct htlc_out * hout ;
210- struct htlc_out_map_iter outi ;
211- for (hout = htlc_out_map_first (htlcs_out , & outi );
212- hout ;
213- hout = htlc_out_map_next (htlcs_out , & outi )) {
214- if (hout -> key .channel != channel )
215- continue ;
216- if (!(htlc_state_flags (hout -> hstate ) & committed_flag ))
217- continue ;
218- if (htlc_is_trimmed (REMOTE , hout -> msat , local_feerate ,
219- channel -> our_config .dust_limit , LOCAL ,
220- channel_has (channel , OPT_ANCHOR_OUTPUTS )))
221- continue ;
222- struct simple_htlc * simple =
223- new_simple_htlc (NULL ,
224- htlc_state_owner (hout -> hstate ),
225- hout -> msat ,
226- & hout -> payment_hash ,
227- hout -> cltv_expiry
228- );
229- tal_arr_expand (& htlcs , tal_steal (htlcs , simple ));
230- }
231- return htlcs ;
232- }
233-
234179static void sign_last_tx (struct channel * channel ,
235180 struct bitcoin_tx * last_tx ,
236181 struct bitcoin_signature * last_sig )
@@ -240,8 +185,6 @@ static void sign_last_tx(struct channel *channel,
240185 u8 * msg , * * witness ;
241186
242187 u64 commit_index = channel -> next_index [LOCAL ] - 1 ;
243- u32 local_feerate = get_feerate (channel -> fee_states , channel -> opener , LOCAL );
244- struct simple_htlc * * htlcs = collect_htlcs (channel , local_feerate );
245188
246189 assert (!last_tx -> wtx -> inputs [0 ].witness );
247190 msg = towire_hsmd_sign_commitment_tx (tmpctx ,
@@ -250,9 +193,7 @@ static void sign_last_tx(struct channel *channel,
250193 last_tx ,
251194 & channel -> channel_info
252195 .remote_fundingkey ,
253- commit_index ,
254- (const struct simple_htlc * * ) htlcs ,
255- local_feerate );
196+ commit_index );
256197
257198 if (!wire_sync_write (ld -> hsm_fd , take (msg )))
258199 fatal ("Could not write to HSM: %s" , strerror (errno ));
0 commit comments