htlcswitch+lnwallet: calculate fee exposure as commit fees + dust

This commit expands the definition of the dust limit to take into
account commitment fees as well as dust HTLCs. The dust limit is now
known as a fee exposure threshold. Dust HTLCs are fees anyways so it
makes sense to account for commitment fees as well. The link has
been modified slightly to calculate dust. In the future, the switch
dust calculations can be removed.
This commit is contained in:
Eugene Siegel
2024-06-03 12:43:33 -04:00
parent b7c59b36a7
commit d6001d033b
11 changed files with 456 additions and 88 deletions

View File

@ -4471,10 +4471,20 @@ func TestChannelLinkUpdateCommitFee(t *testing.T) {
// Triggering the link to update the fee of the channel with a fee rate
// that exceeds its maximum fee allocation should result in a fee rate
// corresponding to the maximum fee allocation.
// corresponding to the maximum fee allocation. Increase the dust
// threshold so that we don't trigger that logic.
highFeeExposure := lnwire.NewMSatFromSatoshis(
2 * btcutil.SatoshiPerBitcoin,
)
const maxFeeRate chainfee.SatPerKWeight = 207180182
n.aliceChannelLink.cfg.MaxFeeExposure = highFeeExposure
n.firstBobChannelLink.cfg.MaxFeeExposure = highFeeExposure
triggerFeeUpdate(maxFeeRate+1, minRelayFee, maxFeeRate, true)
// Decrease the max fee exposure back to normal.
n.aliceChannelLink.cfg.MaxFeeExposure = DefaultMaxFeeExposure
n.firstBobChannelLink.cfg.MaxFeeExposure = DefaultMaxFeeExposure
// Triggering the link to update the fee of the channel with a fee rate
// that is below the current min relay fee rate should result in a fee
// rate corresponding to the minimum relay fee.