From 0e11620865f233c01cf11ef6cec3bcc0a012836b Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Wed, 6 Nov 2024 05:25:05 -0500 Subject: [PATCH] Make canonical call not fail on incorrect height. When the caller, for whatever reason, calls isCanonical with a block header that sits higher on the chain than best block header it cannot be canonical. This case did return false but also an error. Remove the error since the block simply is not canonical. --- service/tbc/crawler.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/service/tbc/crawler.go b/service/tbc/crawler.go index 1d40bc09..1dc96be8 100644 --- a/service/tbc/crawler.go +++ b/service/tbc/crawler.go @@ -199,8 +199,11 @@ func (s *Server) isCanonical(ctx context.Context, bh *tbcd.BlockHeader) (bool, e return false, err } if bhb.Height < bh.Height { - return false, fmt.Errorf("best height less than provided height: %v < %v", + // We either hit a race or the caller did something wrong. + // Either way, it cannot be canonical. + log.Debugf("best height less than provided height: %v < %v", bhb.Height, bh.Height) + return false, nil } if bhb.Hash.IsEqual(&bh.Hash) { // Self == best