From 176fde4ec024fcaa6d459532dc63f5816f71649a Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 24 Oct 2017 18:22:58 -0700 Subject: [PATCH] routing: modify applyChannelUpdate to not error out if update is stale In this commit we fix a slight bug within the existing SendPayment loop which would cause the wrong error to be returned to users. Prior to this commit, if we received an update identical to what we were already aware of, then that error would be returned rather than the ForwardingError that encapsulated this update. In this commit with remedy this by properly returning the exact error. Partially fixes #391. --- routing/router.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/routing/router.go b/routing/router.go index 3b5583410..59ceb22c1 100644 --- a/routing/router.go +++ b/routing/router.go @@ -805,7 +805,7 @@ func (r *ChannelRouter) processUpdate(msg interface{}) error { case 0: if edge1Timestamp.After(msg.LastUpdate) || edge1Timestamp.Equal(msg.LastUpdate) { - return newErrf(ErrIgnored, "Ignoring announcement "+ + return newErrf(ErrIgnored, "Ignoring update "+ "(flags=%v) for known chan_id=%v", msg.Flags, msg.ChannelID) @@ -817,7 +817,7 @@ func (r *ChannelRouter) processUpdate(msg interface{}) error { if edge2Timestamp.After(msg.LastUpdate) || edge2Timestamp.Equal(msg.LastUpdate) { - return newErrf(ErrIgnored, "Ignoring announcement "+ + return newErrf(ErrIgnored, "Ignoring update "+ "(flags=%v) for known chan_id=%v", msg.Flags, msg.ChannelID) } @@ -1477,7 +1477,7 @@ func (r *ChannelRouter) applyChannelUpdate(msg *lnwire.ChannelUpdate) error { FeeBaseMSat: lnwire.MilliSatoshi(msg.BaseFee), FeeProportionalMillionths: lnwire.MilliSatoshi(msg.FeeRate), }) - if err != nil { + if err != nil && !IsError(err, ErrIgnored) { return fmt.Errorf("Unable to apply channel update: %v", err) }