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.
This commit is contained in:
parent
3e64ba0394
commit
176fde4ec0
@ -805,7 +805,7 @@ func (r *ChannelRouter) processUpdate(msg interface{}) error {
|
|||||||
case 0:
|
case 0:
|
||||||
if edge1Timestamp.After(msg.LastUpdate) ||
|
if edge1Timestamp.After(msg.LastUpdate) ||
|
||||||
edge1Timestamp.Equal(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,
|
"(flags=%v) for known chan_id=%v", msg.Flags,
|
||||||
msg.ChannelID)
|
msg.ChannelID)
|
||||||
|
|
||||||
@ -817,7 +817,7 @@ func (r *ChannelRouter) processUpdate(msg interface{}) error {
|
|||||||
if edge2Timestamp.After(msg.LastUpdate) ||
|
if edge2Timestamp.After(msg.LastUpdate) ||
|
||||||
edge2Timestamp.Equal(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,
|
"(flags=%v) for known chan_id=%v", msg.Flags,
|
||||||
msg.ChannelID)
|
msg.ChannelID)
|
||||||
}
|
}
|
||||||
@ -1477,7 +1477,7 @@ func (r *ChannelRouter) applyChannelUpdate(msg *lnwire.ChannelUpdate) error {
|
|||||||
FeeBaseMSat: lnwire.MilliSatoshi(msg.BaseFee),
|
FeeBaseMSat: lnwire.MilliSatoshi(msg.BaseFee),
|
||||||
FeeProportionalMillionths: lnwire.MilliSatoshi(msg.FeeRate),
|
FeeProportionalMillionths: lnwire.MilliSatoshi(msg.FeeRate),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil && !IsError(err, ErrIgnored) {
|
||||||
return fmt.Errorf("Unable to apply channel update: %v", err)
|
return fmt.Errorf("Unable to apply channel update: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user