From 60fcc56be0f435f60e8dd1811667f26c7638a745 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 19 May 2020 18:08:21 -0700 Subject: [PATCH] fix: don't try to marshal a nil record fixes #939 --- p2p/protocol/identify/id.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/p2p/protocol/identify/id.go b/p2p/protocol/identify/id.go index afcbf95661..1eabf9eacf 100644 --- a/p2p/protocol/identify/id.go +++ b/p2p/protocol/identify/id.go @@ -428,9 +428,6 @@ func (ids *IDService) getSnapshot() *identifySnapshot { if !ids.disableSignedPeerRecord { if cab, ok := peerstore.GetCertifiedAddrBook(ids.Host.Peerstore()); ok { snapshot.record = cab.GetPeerRecord(ids.Host.ID()) - if snapshot.record == nil { - log.Errorf("latest peer record does not exist. identify message incomplete!") - } } } snapshot.addrs = ids.Host.Addrs() @@ -465,7 +462,7 @@ func (ids *IDService) populateMessage( mes.ListenAddrs = append(mes.ListenAddrs, addr.Bytes()) } - if !ids.disableSignedPeerRecord { + if !ids.disableSignedPeerRecord && snapshot.record != nil { recBytes, err := snapshot.record.Marshal() if err != nil { log.Errorf("error marshaling peer record: %v", err)