core-lightning/common/htlc_trim.h
Rusty Russell af6d7c0779 global: thread zero fee option everywhere.
In most cases, it's the same as option_anchor_outputs, but for
fees it's different.  This transformation is the simplest:
pass it as a pair, and test it explicitly.

In future we could rationalize some paths, but this was nice
and mechanical.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-06-29 11:28:47 -04:00

20 lines
665 B
C

#ifndef LIGHTNING_COMMON_HTLC_TRIM_H
#define LIGHTNING_COMMON_HTLC_TRIM_H
#include "config.h"
#include <common/amount.h>
#include <common/htlc.h>
/* If this htlc too small to create an output on @side's commitment tx? */
bool htlc_is_trimmed(enum side htlc_owner,
struct amount_msat htlc_amount,
u32 feerate_per_kw,
struct amount_sat dust_limit,
enum side side,
bool option_anchor_outputs,
bool option_anchors_zero_fee_htlc_tx);
/* Calculate the our htlc-trimming buffer feerate
* (max(25%, 10s/vbyte) above feerate_per_kw) */
u32 htlc_trim_feerate_ceiling(u32 feerate_per_kw);
#endif /* LIGHTNING_COMMON_HTLC_TRIM_H */