From 897a19d9dfd35b8e4c6d8632c57f0aa28c1b3bac Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 20 Apr 2021 18:23:10 -0500 Subject: [PATCH] routing: add new error for invalid funding tx rejection --- routing/errors.go | 4 ++++ routing/router.go | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/routing/errors.go b/routing/errors.go index ff055d2e..b7421e6d 100644 --- a/routing/errors.go +++ b/routing/errors.go @@ -20,6 +20,10 @@ const ( // the purported funding output has actually already been spent on // chain. ErrChannelSpent + + // ErrNoFundingTransaction is returned when we are unable to find the + // funding transaction described by the short channel ID on chain. + ErrNoFundingTransaction ) // routerError is a structure that represent the error inside the routing package, diff --git a/routing/router.go b/routing/router.go index 673b2cef..7cb3a526 100644 --- a/routing/router.go +++ b/routing/router.go @@ -1309,8 +1309,9 @@ func (r *ChannelRouter) processUpdate(msg interface{}, channelID := lnwire.NewShortChanIDFromInt(msg.ChannelID) fundingTx, err := r.fetchFundingTx(&channelID) if err != nil { - return errors.Errorf("unable to fetch funding tx for "+ - "chan_id=%v: %v", msg.ChannelID, err) + return newErrf(ErrNoFundingTransaction, "unable to "+ + "fetch funding tx for chan_id=%v: %v", + msg.ChannelID, err) } // Recreate witness output to be sure that declared in channel