diff --git a/htlcswitch/interfaces.go b/htlcswitch/interfaces.go index c2520428f..423402e4f 100644 --- a/htlcswitch/interfaces.go +++ b/htlcswitch/interfaces.go @@ -85,7 +85,7 @@ type scidAliasHandler interface { // HTLCs on option_scid_alias channels. attachFailAliasUpdate(failClosure func( sid lnwire.ShortChannelID, - incoming bool) *lnwire.ChannelUpdate1) + incoming bool) lnwire.ChannelUpdate) // getAliases fetches the link's underlying aliases. This is used by // the Switch to determine whether to forward an HTLC and where to diff --git a/htlcswitch/link.go b/htlcswitch/link.go index f5516d4eb..da80327ae 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -262,7 +262,7 @@ type ChannelLinkConfig struct { // FailAliasUpdate is a function used to fail an HTLC for an // option_scid_alias channel. FailAliasUpdate func(sid lnwire.ShortChannelID, - incoming bool) *lnwire.ChannelUpdate1 + incoming bool) lnwire.ChannelUpdate // GetAliases is used by the link and switch to fetch the set of // aliases for a given link. @@ -764,7 +764,7 @@ func shouldAdjustCommitFee(netFee, chanFee, } // failCb is used to cut down on the argument verbosity. -type failCb func(update *lnwire.ChannelUpdate1) lnwire.FailureMessage +type failCb func(update lnwire.ChannelUpdate) lnwire.FailureMessage // createFailureWithUpdate creates a ChannelUpdate when failing an incoming or // outgoing HTLC. It may return a FailureMessage that references a channel's @@ -2962,7 +2962,7 @@ func (l *channelLink) getAliases() []lnwire.ShortChannelID { // // Part of the scidAliasHandler interface. func (l *channelLink) attachFailAliasUpdate(closure func( - sid lnwire.ShortChannelID, incoming bool) *lnwire.ChannelUpdate1) { + sid lnwire.ShortChannelID, incoming bool) lnwire.ChannelUpdate) { l.Lock() l.cfg.FailAliasUpdate = closure @@ -3054,7 +3054,7 @@ func (l *channelLink) CheckHtlcForward(payHash [32]byte, // As part of the returned error, we'll send our latest routing // policy so the sending node obtains the most up to date data. - cb := func(upd *lnwire.ChannelUpdate1) lnwire.FailureMessage { + cb := func(upd lnwire.ChannelUpdate) lnwire.FailureMessage { return lnwire.NewFeeInsufficient(amtToForward, upd) } failure := l.createFailureWithUpdate(false, originalScid, cb) @@ -3082,7 +3082,7 @@ func (l *channelLink) CheckHtlcForward(payHash [32]byte, // Grab the latest routing policy so the sending node is up to // date with our current policy. - cb := func(upd *lnwire.ChannelUpdate1) lnwire.FailureMessage { + cb := func(upd lnwire.ChannelUpdate) lnwire.FailureMessage { return lnwire.NewIncorrectCltvExpiry( incomingTimeout, upd, ) @@ -3131,7 +3131,7 @@ func (l *channelLink) canSendHtlc(policy models.ForwardingPolicy, // As part of the returned error, we'll send our latest routing // policy so the sending node obtains the most up to date data. - cb := func(upd *lnwire.ChannelUpdate1) lnwire.FailureMessage { + cb := func(upd lnwire.ChannelUpdate) lnwire.FailureMessage { return lnwire.NewAmountBelowMinimum(amt, upd) } failure := l.createFailureWithUpdate(false, originalScid, cb) @@ -3146,7 +3146,7 @@ func (l *channelLink) canSendHtlc(policy models.ForwardingPolicy, // As part of the returned error, we'll send our latest routing // policy so the sending node obtains the most up-to-date data. - cb := func(upd *lnwire.ChannelUpdate1) lnwire.FailureMessage { + cb := func(upd lnwire.ChannelUpdate) lnwire.FailureMessage { return lnwire.NewTemporaryChannelFailure(upd) } failure := l.createFailureWithUpdate(false, originalScid, cb) @@ -3161,7 +3161,7 @@ func (l *channelLink) canSendHtlc(policy models.ForwardingPolicy, "outgoing_expiry=%v, best_height=%v", payHash[:], timeout, heightNow) - cb := func(upd *lnwire.ChannelUpdate1) lnwire.FailureMessage { + cb := func(upd lnwire.ChannelUpdate) lnwire.FailureMessage { return lnwire.NewExpiryTooSoon(upd) } failure := l.createFailureWithUpdate(false, originalScid, cb) @@ -3181,7 +3181,7 @@ func (l *channelLink) canSendHtlc(policy models.ForwardingPolicy, if amt > l.Bandwidth() { l.log.Warnf("insufficient bandwidth to route htlc: %v is "+ "larger than %v", amt, l.Bandwidth()) - cb := func(upd *lnwire.ChannelUpdate1) lnwire.FailureMessage { + cb := func(upd lnwire.ChannelUpdate) lnwire.FailureMessage { return lnwire.NewTemporaryChannelFailure(upd) } failure := l.createFailureWithUpdate(false, originalScid, cb) @@ -3694,7 +3694,8 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg, l.log.Errorf("unable to encode the "+ "remaining route %v", err) - cb := func(upd *lnwire.ChannelUpdate1) lnwire.FailureMessage { //nolint:lll + //nolint:lll + cb := func(upd lnwire.ChannelUpdate) lnwire.FailureMessage { return lnwire.NewTemporaryChannelFailure(upd) } diff --git a/htlcswitch/link_test.go b/htlcswitch/link_test.go index 4d07b28ef..d9a479a63 100644 --- a/htlcswitch/link_test.go +++ b/htlcswitch/link_test.go @@ -6172,7 +6172,7 @@ func TestCheckHtlcForward(t *testing.T) { } failAliasUpdate := func(sid lnwire.ShortChannelID, - incoming bool) *lnwire.ChannelUpdate1 { + incoming bool) lnwire.ChannelUpdate { return nil } diff --git a/htlcswitch/mock.go b/htlcswitch/mock.go index 6372f2a04..b8bf3ce3a 100644 --- a/htlcswitch/mock.go +++ b/htlcswitch/mock.go @@ -743,7 +743,7 @@ type mockChannelLink struct { checkHtlcForwardResult *LinkError failAliasUpdate func(sid lnwire.ShortChannelID, - incoming bool) *lnwire.ChannelUpdate1 + incoming bool) lnwire.ChannelUpdate confirmedZC bool } @@ -878,7 +878,7 @@ func (f *mockChannelLink) AttachMailBox(mailBox MailBox) { } func (f *mockChannelLink) attachFailAliasUpdate(closure func( - sid lnwire.ShortChannelID, incoming bool) *lnwire.ChannelUpdate1) { + sid lnwire.ShortChannelID, incoming bool) lnwire.ChannelUpdate) { f.failAliasUpdate = closure } diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go index 02bda7999..a3366146f 100644 --- a/htlcswitch/switch.go +++ b/htlcswitch/switch.go @@ -2614,7 +2614,7 @@ func (s *Switch) failMailboxUpdate(outgoingScid, // and the caller is expected to handle this properly. In this case, a return // to the original non-alias behavior is expected. func (s *Switch) failAliasUpdate(scid lnwire.ShortChannelID, - incoming bool) *lnwire.ChannelUpdate1 { + incoming bool) lnwire.ChannelUpdate { // This function does not defer the unlocking because of the database // lookups for ChannelUpdate.