From 5c3396c6977fcda6eeacc70cd7073fd4d60a512c Mon Sep 17 00:00:00 2001 From: gammazero Date: Fri, 15 Sep 2023 01:55:58 -0700 Subject: [PATCH] Update dtsync head error message If the head protocol is not supported, only an error that contains the correct protocol name. --- dagsync/dtsync/head/head.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dagsync/dtsync/head/head.go b/dagsync/dtsync/head/head.go index f6ec73e..af2c10a 100644 --- a/dagsync/dtsync/head/head.go +++ b/dagsync/dtsync/head/head.go @@ -82,10 +82,11 @@ func QueryRootCid(ctx context.Context, host host.Host, topic string, peerID peer // If protocol ID is wrong, then try the previous protocol ID. var errNoSupport multistream.ErrNotSupported[protocol.ID] if errors.As(err, &errNoSupport) { + origErr := err oldProtoID := previousProtocolID(topic) conn, err = gostream.Dial(ctx, host, peerID, oldProtoID) if err != nil { - return nil, err + return nil, origErr } log.Infow("Peer head CID server uses old protocol ID", "peer", peerID, "proto", oldProtoID) } else {