MCPcopy Create free account
hub / github.com/ElementsProject/lightning / htlc_dust

Function htlc_dust

channeld/full_channel.c:427–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

425}
426
427static bool htlc_dust(const struct channel *channel,
428 const struct htlc **committed,
429 const struct htlc **adding,
430 const struct htlc **removing,
431 enum side side,
432 u32 feerate,
433 struct amount_msat *trim_total)
434{
435 struct amount_sat dust_limit = channel->config[side].dust_limit;
436 bool option_anchor_outputs = channel_has(channel, OPT_ANCHOR_OUTPUTS);
437 struct amount_msat trim_rmvd = AMOUNT_MSAT(0);
438
439 if (!commit_tx_amount_trimmed(committed, feerate,
440 dust_limit,
441 option_anchor_outputs,
442 side, trim_total))
443 return false;
444 if (!commit_tx_amount_trimmed(adding, feerate,
445 dust_limit,
446 option_anchor_outputs,
447 side, trim_total))
448 return false;
449 if (!commit_tx_amount_trimmed(removing, feerate,
450 dust_limit,
451 option_anchor_outputs,
452 side, &trim_rmvd))
453 return false;
454
455 return amount_msat_sub(trim_total, *trim_total, trim_rmvd);
456}
457
458/*
459 * There is a corner case where the opener can spend so much that the

Callers 2

add_htlcFunction · 0.85
htlc_calculate_dustFunction · 0.85

Calls 3

commit_tx_amount_trimmedFunction · 0.85
amount_msat_subFunction · 0.85
channel_hasFunction · 0.50

Tested by

no test coverage detected