diff --git a/node/consensus/ceremony/broadcast_messaging.go b/node/consensus/ceremony/broadcast_messaging.go index d4bf0c5..085a2f5 100644 --- a/node/consensus/ceremony/broadcast_messaging.go +++ b/node/consensus/ceremony/broadcast_messaging.go @@ -170,41 +170,18 @@ func (e *CeremonyDataClockConsensusEngine) handleCeremonyPeerListAnnounce( } multiaddr := p.Multiaddr - if bytes.Equal(p.PeerId, peerID) { + if bytes.Equal(p.PeerId, peerID) || p.Multiaddr == "" { // we have to fetch self-reported peer info multiaddr = e.pubSub.GetMultiaddrOfPeer(peerID) } - pr, ok := e.peerMap[string(p.PeerId)] - if !ok { - e.peerMap[string(p.PeerId)] = &peerInfo{ - peerId: p.PeerId, - multiaddr: multiaddr, - maxFrame: p.MaxFrame, - direct: bytes.Equal(p.PeerId, peerID), - lastSeen: time.Now().Unix(), - timestamp: p.Timestamp, - } - } else { - if bytes.Equal(p.PeerId, peerID) { - e.peerMap[string(p.PeerId)] = &peerInfo{ - peerId: p.PeerId, - multiaddr: multiaddr, - maxFrame: p.MaxFrame, - direct: true, - lastSeen: time.Now().Unix(), - timestamp: p.Timestamp, - } - } else if !pr.direct || time.Now().Unix()-pr.lastSeen > 30 { - e.peerMap[string(p.PeerId)] = &peerInfo{ - peerId: p.PeerId, - multiaddr: p.Multiaddr, - maxFrame: p.MaxFrame, - direct: false, - lastSeen: time.Now().Unix(), - timestamp: p.Timestamp, - } - } + e.peerMap[string(p.PeerId)] = &peerInfo{ + peerId: p.PeerId, + multiaddr: multiaddr, + maxFrame: p.MaxFrame, + direct: bytes.Equal(p.PeerId, peerID), + lastSeen: time.Now().Unix(), + timestamp: p.Timestamp, } } e.peerMapMx.Unlock() diff --git a/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go b/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go index 40cbcc5..1ce6b62 100644 --- a/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go +++ b/node/consensus/ceremony/ceremony_data_clock_consensus_engine.go @@ -22,7 +22,7 @@ import ( "source.quilibrium.com/quilibrium/monorepo/node/tries" ) -const PEER_INFO_TTL = 5 * 60 * 1000 +const PEER_INFO_TTL = 60 * 60 * 1000 const UNCOOPERATIVE_PEER_INFO_TTL = 60 * 60 * 1000 type InclusionMap = map[curves.PairingPoint]*protobufs.InclusionCommitment