From d9d18512cabbac89d43303cee701778ba753e9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Tue, 12 May 2020 17:24:58 +0100 Subject: [PATCH] fix a compilation error introduced in 077a818. (#919) --- p2p/host/basic/basic_host.go | 2 +- p2p/host/basic/basic_host_test.go | 6 +++--- p2p/protocol/identify/id.go | 2 +- p2p/protocol/identify/id_test.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/p2p/host/basic/basic_host.go b/p2p/host/basic/basic_host.go index 2870e06f..91e10192 100644 --- a/p2p/host/basic/basic_host.go +++ b/p2p/host/basic/basic_host.go @@ -376,7 +376,7 @@ func (h *BasicHost) background() { log.Errorf("error creating a signed peer record from the set of current addresses, err=%s", err) return } - changeEvt.SignedPeerRecord = *sr + changeEvt.SignedPeerRecord = sr // persist the signed record to the peerstore if _, err := h.caBook.ConsumePeerRecord(sr, peerstore.PermanentAddrTTL); err != nil { diff --git a/p2p/host/basic/basic_host_test.go b/p2p/host/basic/basic_host_test.go index bd37191f..3b203347 100644 --- a/p2p/host/basic/basic_host_test.go +++ b/p2p/host/basic/basic_host_test.go @@ -589,7 +589,7 @@ func TestAddrChangeImmediatelyIfAddressNonEmpty(t *testing.T) { // assert it's in the peerstore ev := h.Peerstore().(peerstore.CertifiedAddrBook).GetPeerRecord(h.ID()) require.NotNil(t, ev) - rc = peerRecordFromEnvelope(t, *ev) + rc = peerRecordFromEnvelope(t, ev) require.Equal(t, taddrs, rc.Addrs) } @@ -678,7 +678,7 @@ func TestHostAddrChangeDetection(t *testing.T) { // assert it's in the peerstore ev := h.Peerstore().(peerstore.CertifiedAddrBook).GetPeerRecord(h.ID()) require.NotNil(t, ev) - rc = peerRecordFromEnvelope(t, *ev) + rc = peerRecordFromEnvelope(t, ev) require.Equal(t, addrSets[i], rc.Addrs) } } @@ -738,7 +738,7 @@ func updatedAddrEventsEqual(a, b event.EvtLocalAddressesUpdated) bool { updatedAddrsEqual(a.Removed, b.Removed) } -func peerRecordFromEnvelope(t *testing.T, ev record.Envelope) *peer.PeerRecord { +func peerRecordFromEnvelope(t *testing.T, ev *record.Envelope) *peer.PeerRecord { t.Helper() rec, err := ev.Record() if err != nil { diff --git a/p2p/protocol/identify/id.go b/p2p/protocol/identify/id.go index 78f0d074..a3649a53 100644 --- a/p2p/protocol/identify/id.go +++ b/p2p/protocol/identify/id.go @@ -204,7 +204,7 @@ func (ids *IDService) handleProtosChanged(evt event.EvtLocalProtocolsUpdated) { func (ids *IDService) handleLocalAddrsUpdated(evt event.EvtLocalAddressesUpdated) { ids.peerrecMu.Lock() rec := evt.SignedPeerRecord - ids.peerrec = &rec + ids.peerrec = rec ids.peerrecMu.Unlock() log.Debug("triggering push based on updated local PeerRecord") diff --git a/p2p/protocol/identify/id_test.go b/p2p/protocol/identify/id_test.go index 6c45e542..577f61e5 100644 --- a/p2p/protocol/identify/id_test.go +++ b/p2p/protocol/identify/id_test.go @@ -236,7 +236,7 @@ func generatePeerRecord(t *testing.T, h host.Host) { if err != nil { t.Fatalf("error generating peer record: %s", err) } - evt := event.EvtLocalAddressesUpdated{SignedPeerRecord: *signed} + evt := event.EvtLocalAddressesUpdated{SignedPeerRecord: signed} emitter, err := h.EventBus().Emitter(new(event.EvtLocalAddressesUpdated), eventbus.Stateful) if err != nil { t.Fatal(err)