lnworker: use PaymentFeeBudget
- introduce PaymentFeeBudget, which contains limits for fee budget and cltv budget
- when splitting a payment,
- the fee budget is linearly distributed between the parts
- this resolves a FIXME in lnrouter ("FIXME in case of MPP")
- the cltv budget is simply copied
- we could also add other kinds of budgets later, e.g. for the num in-flight htlcs
- resolves TODO in lnworker ("todo: compare to the fee of the actual route we found")
This commit is contained in:
@@ -1637,3 +1637,19 @@ class OnionFailureCodeMetaFlag(IntFlag):
|
||||
UPDATE = 0x1000
|
||||
|
||||
|
||||
class PaymentFeeBudget(NamedTuple):
|
||||
fee_msat: int
|
||||
|
||||
# The cltv budget covers the cost of route to get to the destination, but excluding the
|
||||
# cltv-delta the destination wants for itself. (e.g. "min_final_cltv_delta" is excluded)
|
||||
cltv: int # this is cltv-delta-like, no absolute heights here!
|
||||
|
||||
#num_htlc: int
|
||||
|
||||
@classmethod
|
||||
def default(cls, *, invoice_amount_msat: int) -> 'PaymentFeeBudget':
|
||||
from .lnrouter import get_default_fee_budget_msat
|
||||
return PaymentFeeBudget(
|
||||
fee_msat=get_default_fee_budget_msat(invoice_amount_msat=invoice_amount_msat),
|
||||
cltv=NBLOCK_CLTV_DELTA_TOO_FAR_INTO_FUTURE,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user