mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-09 01:32:09 +02:00
htlcswitch: remove PaymentDescriptor from hodlHtlc
This is part of a systematic removal of PaymentDescriptor from the mechanics of the htlcswitch package.
This commit is contained in:
committed by
Oliver Gugger
parent
e7d545fb0a
commit
dd9568b648
@@ -442,7 +442,8 @@ func (m *hookMap) invoke() {
|
|||||||
|
|
||||||
// hodlHtlc contains htlc data that is required for resolution.
|
// hodlHtlc contains htlc data that is required for resolution.
|
||||||
type hodlHtlc struct {
|
type hodlHtlc struct {
|
||||||
pd *lnwallet.PaymentDescriptor
|
add lnwire.UpdateAddHTLC
|
||||||
|
sourceRef channeldb.AddRef
|
||||||
obfuscator hop.ErrorEncrypter
|
obfuscator hop.ErrorEncrypter
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1521,7 +1522,7 @@ func (l *channelLink) processHtlcResolution(resolution invoices.HtlcResolution,
|
|||||||
"with outcome: %v", circuitKey, res.Outcome)
|
"with outcome: %v", circuitKey, res.Outcome)
|
||||||
|
|
||||||
return l.settleHTLC(
|
return l.settleHTLC(
|
||||||
res.Preimage, htlc.pd.HtlcIndex, *htlc.pd.SourceRef,
|
res.Preimage, htlc.add.ID, htlc.sourceRef,
|
||||||
)
|
)
|
||||||
|
|
||||||
// For htlc failures, we get the relevant failure message based
|
// For htlc failures, we get the relevant failure message based
|
||||||
@@ -1532,12 +1533,10 @@ func (l *channelLink) processHtlcResolution(resolution invoices.HtlcResolution,
|
|||||||
|
|
||||||
// Get the lnwire failure message based on the resolution
|
// Get the lnwire failure message based on the resolution
|
||||||
// result.
|
// result.
|
||||||
failure := getResolutionFailure(res, htlc.pd.Amount)
|
failure := getResolutionFailure(res, htlc.add.Amount)
|
||||||
|
|
||||||
//nolint:forcetypeassert
|
|
||||||
add := htlc.pd.ToLogUpdate().UpdateMsg.(*lnwire.UpdateAddHTLC)
|
|
||||||
l.sendHTLCError(
|
l.sendHTLCError(
|
||||||
*add, *htlc.pd.SourceRef, failure, htlc.obfuscator,
|
htlc.add, htlc.sourceRef, failure, htlc.obfuscator,
|
||||||
true,
|
true,
|
||||||
)
|
)
|
||||||
return nil
|
return nil
|
||||||
@@ -3860,16 +3859,8 @@ func (l *channelLink) processExitHop(add lnwire.UpdateAddHTLC,
|
|||||||
|
|
||||||
// Create a hodlHtlc struct and decide either resolved now or later.
|
// Create a hodlHtlc struct and decide either resolved now or later.
|
||||||
htlc := hodlHtlc{
|
htlc := hodlHtlc{
|
||||||
pd: &lnwallet.PaymentDescriptor{
|
add: add,
|
||||||
EntryType: lnwallet.Add,
|
sourceRef: sourceRef,
|
||||||
ChanID: add.ChanID,
|
|
||||||
RHash: add.PaymentHash,
|
|
||||||
Timeout: add.Expiry,
|
|
||||||
Amount: add.Amount,
|
|
||||||
HtlcIndex: add.ID,
|
|
||||||
SourceRef: &sourceRef,
|
|
||||||
BlindingPoint: add.BlindingPoint,
|
|
||||||
},
|
|
||||||
obfuscator: obfuscator,
|
obfuscator: obfuscator,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user