From faa85686fd7379f0e90b3946f4943a8913fdcc20 Mon Sep 17 00:00:00 2001 From: Andrew Gillis Date: Thu, 25 May 2023 14:59:52 -0700 Subject: [PATCH] Fix incorrect log message and comment (#368) Fixes #365 --- engine/engine.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engine/engine.go b/engine/engine.go index 0edac3b0..9b7fcf84 100644 --- a/engine/engine.go +++ b/engine/engine.go @@ -577,15 +577,15 @@ func (e *Engine) publishAdvForIndex(ctx context.Context, p peer.ID, addrs []mult } // Check for cid.Undef for the previous link. If this is the case, then - // this means there is a "cid too short" error in IPLD links serialization. - if prevAdvID != cid.Undef { + // this means there are no previous advertisements. + if prevAdvID == cid.Undef { log.Info("Latest advertisement CID was undefined - no previous advertisement") - prev := ipld.Link(cidlink.Link{Cid: prevAdvID}) - adv.PreviousID = prev + } else { + adv.PreviousID = ipld.Link(cidlink.Link{Cid: prevAdvID}) } // Sign the advertisement. - if err := adv.Sign(e.key); err != nil { + if err = adv.Sign(e.key); err != nil { return cid.Undef, err } return e.Publish(ctx, adv)