lnwallet: inline processUpdateFee and remove the function entirely

In this commit we observe that the previous commit reduced the role
of this function to a single assignment statement with numerous newly
irrelevant parameters. This commit makes the choice of inlining it at
the two call-sites within evaluateHTLCView and removing the funciton
definition entirely. This also allows us to drop a huge portion of
newly irrelevant test code.
This commit is contained in:
Keagan McClelland committed 2024-10-11 11:25:58 +02:00
1 parent 05347c8392
commit 819239c5c8
2 files changed
+11 -234

No files matched your search

+11 -17
View File
@@ -2932,9 +2932,11 @@ func (lc *LightningChannel) evaluateHTLCView(view *HtlcView, ourBalance,
)
if h == 0 {
processFeeUpdate(
entry, &newView.FeePerKw, nextHeight,
whoseCommitChain,
// If the update wasn't already locked in,
// update the current fee rate to reflect this
// update.
newView.FeePerKw = chainfee.SatPerKWeight(
entry.Amount.ToSatoshis(),
)
if mutateState {
@@ -2996,11 +2998,14 @@ func (lc *LightningChannel) evaluateHTLCView(view *HtlcView, ourBalance,
)
if h == 0 {
processFeeUpdate(
entry, &newView.FeePerKw, nextHeight,
whoseCommitChain,
// If the update wasn't already locked in,
// update the current fee rate to reflect this
// update.
newView.FeePerKw = chainfee.SatPerKWeight(
entry.Amount.ToSatoshis(),
)
if mutateState {
entry.addCommitHeights.SetForParty(
whoseCommitChain, nextHeight,
@@ -3206,17 +3211,6 @@ func processRemoveEntry(htlc *paymentDescriptor, ourBalance,
}
}
// processFeeUpdate processes a log update that updates the current commitment
// fee.
func processFeeUpdate(feeUpdate *paymentDescriptor,
feeRef *chainfee.SatPerKWeight, nextHeight uint64,
whoseCommitChain lntypes.ChannelParty) {
// If the update wasn't already locked in, update the current fee rate
// to reflect this update.
*feeRef = chainfee.SatPerKWeight(feeUpdate.Amount.ToSatoshis())
}
// generateRemoteHtlcSigJobs generates a series of HTLC signature jobs for the
// sig pool, along with a channel that if closed, will cancel any jobs after
// they have been submitted to the sigPool. This method is to be used when