Skip to content

Commit d9ab160

Browse files
committed
Changed sign_holder_commitment htlc filters to match commit_tx
1 parent a49e1c8 commit d9ab160

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lightningd/peer_control.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ static struct simple_htlc **collect_htlcs(struct channel *channel, u32 local_fee
181181
struct htlc_in_map *htlcs_in = &channel->peer->ld->htlcs_in;
182182
struct htlc_out_map *htlcs_out = &channel->peer->ld->htlcs_out;
183183
struct simple_htlc **htlcs = tal_arr(tmpctx, struct simple_htlc *, 0);
184+
const int committed_flag = HTLC_FLAG(REMOTE, HTLC_F_COMMITTED);
184185

185186
const struct htlc_in *hin;
186187
struct htlc_in_map_iter ini;
@@ -189,8 +190,8 @@ static struct simple_htlc **collect_htlcs(struct channel *channel, u32 local_fee
189190
hin = htlc_in_map_next(htlcs_in, &ini)) {
190191
if (hin->key.channel != channel)
191192
continue;
192-
// FIXME - Do we need a hin->hstate filter here? The
193-
// integration tests pass without having one ...
193+
if (!(htlc_state_flags(hin->hstate) & committed_flag))
194+
continue;
194195
if (htlc_is_trimmed(REMOTE, hin->msat, local_feerate,
195196
channel->our_config.dust_limit, LOCAL,
196197
channel_has(channel, OPT_ANCHOR_OUTPUTS)))
@@ -204,14 +205,15 @@ static struct simple_htlc **collect_htlcs(struct channel *channel, u32 local_fee
204205
);
205206
tal_arr_expand(&htlcs, tal_steal(htlcs, simple));
206207
}
208+
207209
const struct htlc_out *hout;
208210
struct htlc_out_map_iter outi;
209211
for (hout = htlc_out_map_first(htlcs_out, &outi);
210212
hout;
211213
hout = htlc_out_map_next(htlcs_out, &outi)) {
212214
if (hout->key.channel != channel)
213215
continue;
214-
if (hout->hstate < RCVD_ADD_REVOCATION || hout->hstate > RCVD_REMOVE_COMMIT)
216+
if (!(htlc_state_flags(hout->hstate) & committed_flag))
215217
continue;
216218
if (htlc_is_trimmed(REMOTE, hout->msat, local_feerate,
217219
channel->our_config.dust_limit, LOCAL,

0 commit comments

Comments
 (0)