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

Function subtract_offered_htlcs

lightningd/peer_control.c:579–594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

577}
578
579static void subtract_offered_htlcs(const struct channel *channel,
580 struct amount_msat *amount)
581{
582 const struct htlc_out *hout;
583 struct htlc_out_map_iter outi;
584 struct lightningd *ld = channel->peer->ld;
585
586 for (hout = htlc_out_map_first(&ld->htlcs_out, &outi);
587 hout;
588 hout = htlc_out_map_next(&ld->htlcs_out, &outi)) {
589 if (hout->key.channel != channel)
590 continue;
591 if (!amount_msat_sub(amount, *amount, hout->msat))
592 *amount = AMOUNT_MSAT(0);
593 }
594}
595
596static void subtract_received_htlcs(const struct channel *channel,
597 struct amount_msat *amount)

Callers 1

channel_amount_spendableFunction · 0.85

Calls 1

amount_msat_subFunction · 0.85

Tested by

no test coverage detected