Skip to content

Commit

Permalink
Fix incorrect log message and comment (#368)
Browse files Browse the repository at this point in the history
Fixes #365
  • Loading branch information
gammazero authored May 25, 2023
1 parent e247a19 commit faa8568
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit faa8568

Please sign in to comment.