From 3c14a746c99cb4c65ee329a2701af32ded34c100 Mon Sep 17 00:00:00 2001 From: Pavel Zbitskiy Date: Fri, 21 Jun 2024 10:23:08 -0400 Subject: [PATCH] CR: fix identityOpts reuse concern --- network/hybridNetwork.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/network/hybridNetwork.go b/network/hybridNetwork.go index 7a683449ee..cd95203b35 100644 --- a/network/hybridNetwork.go +++ b/network/hybridNetwork.go @@ -42,14 +42,16 @@ func NewHybridP2PNetwork(log logging.Logger, cfg config.Local, datadir string, p // supply alternate NetAddress for P2P network p2pcfg := cfg p2pcfg.NetAddress = cfg.P2PListenAddress - identityOpts := identityOpts{ - tracker: NewIdentityTracker(), - } - p2pnet, err := NewP2PNetwork(log, p2pcfg, datadir, phonebookAddresses, genesisID, networkID, nodeInfo, &identityOpts) + identityTracker := NewIdentityTracker() + p2pnet, err := NewP2PNetwork(log, p2pcfg, datadir, phonebookAddresses, genesisID, networkID, nodeInfo, &identityOpts{tracker: identityTracker}) if err != nil { return nil, err } - identityOpts.scheme = NewIdentityChallengeScheme(NetIdentityDedupNames(cfg.PublicAddress, p2pnet.PeerID().String()), NetIdentitySigner(p2pnet.PeerIDSigner())) + + identityOpts := identityOpts{ + tracker: identityTracker, + scheme: NewIdentityChallengeScheme(NetIdentityDedupNames(cfg.PublicAddress, p2pnet.PeerID().String()), NetIdentitySigner(p2pnet.PeerIDSigner())), + } wsnet, err := NewWebsocketNetwork(log, cfg, phonebookAddresses, genesisID, networkID, nodeInfo, &identityOpts) if err != nil { return nil, err