From 0dc6f8058d0f947908b6bdce664be405c4e5aa7c Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 20 Apr 2021 18:22:36 -0500 Subject: [PATCH] routing: add new error for spent channel UTXOs --- routing/errors.go | 5 +++++ routing/router.go | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/routing/errors.go b/routing/errors.go index a8bd6fbaa..ff055d2eb 100644 --- a/routing/errors.go +++ b/routing/errors.go @@ -15,6 +15,11 @@ const ( // this update can't bring us something new, or because a node // announcement was given for node not found in any channel. ErrIgnored + + // ErrChannelSpent is returned when we go to validate a channel, but + // the purported funding output has actually already been spent on + // chain. + ErrChannelSpent ) // routerError is a structure that represent the error inside the routing package, diff --git a/routing/router.go b/routing/router.go index a1f502154..673b2cefc 100644 --- a/routing/router.go +++ b/routing/router.go @@ -1354,7 +1354,8 @@ func (r *ChannelRouter) processUpdate(msg interface{}, r.quit, ) if err != nil { - return fmt.Errorf("unable to fetch utxo "+ + + return newErrf(ErrChannelSpent, "unable to fetch utxo "+ "for chan_id=%v, chan_point=%v: %v", msg.ChannelID, fundingPoint, err) }