mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-27 19:06:17 +02:00
lnwire+htlcswitch: only use references for failure messages
Methods on failure message types used to be defined on value receivers. This allowed assignment of a failure message to ForwardingError both as a value and as a pointer. This is error-prone, especially when using a type switch. In this commit the failure message methods are changed so that they target pointer receivers. Two instances where a value was assigned instead of a reference are fixed.
This commit is contained in:
@@ -1214,7 +1214,7 @@ func (l *channelLink) processHodlEvent(hodlEvent invoices.HodlEvent,
|
||||
)
|
||||
|
||||
case invoices.CancelExpiryTooSoon:
|
||||
failure = lnwire.FailFinalExpiryTooSoon{}
|
||||
failure = &lnwire.FailFinalExpiryTooSoon{}
|
||||
|
||||
default:
|
||||
return fmt.Errorf("unknown cancel reason: %v",
|
||||
|
@@ -981,7 +981,7 @@ func (s *Switch) parseFailedPayment(deobfuscator ErrorDecrypter,
|
||||
return &ForwardingError{
|
||||
FailureSourceIdx: 0,
|
||||
ExtraMsg: userErr,
|
||||
FailureMessage: lnwire.FailPermanentChannelFailure{},
|
||||
FailureMessage: &lnwire.FailPermanentChannelFailure{},
|
||||
}
|
||||
|
||||
// A regular multi-hop payment error that we'll need to
|
||||
|
Reference in New Issue
Block a user