mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-11-10 18:25:17 +00:00
fix: set peer info broadcasts to only self (#74)
This commit is contained in:
parent
4fc58358a8
commit
b90b88c6e3
@ -133,10 +133,6 @@ func (e *CeremonyDataClockConsensusEngine) handleCeremonyPeerListAnnounce(
|
||||
return errors.Wrap(err, "handle ceremony peer list announce")
|
||||
}
|
||||
|
||||
e.peerAnnounceMapMx.Lock()
|
||||
e.peerAnnounceMap[string(peerID)] = announce
|
||||
e.peerAnnounceMapMx.Unlock()
|
||||
|
||||
for _, p := range announce.PeerList {
|
||||
e.peerMapMx.Lock()
|
||||
if _, ok := e.uncooperativePeersMap[string(p.PeerId)]; ok {
|
||||
|
@ -101,7 +101,6 @@ type CeremonyDataClockConsensusEngine struct {
|
||||
peerMapMx sync.Mutex
|
||||
peerAnnounceMapMx sync.Mutex
|
||||
lastKeyBundleAnnouncementFrame uint64
|
||||
peerAnnounceMap map[string]*protobufs.CeremonyPeerListAnnounce
|
||||
peerMap map[string]*peerInfo
|
||||
uncooperativePeersMap map[string]*peerInfo
|
||||
}
|
||||
@ -227,7 +226,6 @@ func NewCeremonyDataClockConsensusEngine(
|
||||
frameProverTrie: &tries.RollingFrecencyCritbitTrie{},
|
||||
inclusionProver: inclusionProver,
|
||||
syncingStatus: SyncStatusNotSyncing,
|
||||
peerAnnounceMap: map[string]*protobufs.CeremonyPeerListAnnounce{},
|
||||
peerMap: map[string]*peerInfo{},
|
||||
uncooperativePeersMap: map[string]*peerInfo{},
|
||||
minimumPeersRequired: minimumPeersRequired,
|
||||
@ -330,20 +328,18 @@ func (e *CeremonyDataClockConsensusEngine) Start() <-chan error {
|
||||
),
|
||||
}
|
||||
deletes := []*peerInfo{}
|
||||
for _, v := range e.peerMap {
|
||||
list.PeerList = append(list.PeerList, &protobufs.CeremonyPeer{
|
||||
PeerId: v.peerId,
|
||||
Multiaddr: v.multiaddr,
|
||||
MaxFrame: v.maxFrame,
|
||||
Timestamp: v.timestamp,
|
||||
Version: v.version,
|
||||
Signature: v.signature,
|
||||
PublicKey: v.publicKey,
|
||||
TotalDistance: e.dataTimeReel.GetTotalDistance().FillBytes(
|
||||
make([]byte, 256),
|
||||
),
|
||||
})
|
||||
}
|
||||
list.PeerList = append(list.PeerList, &protobufs.CeremonyPeer{
|
||||
PeerId: e.pubSub.GetPeerID(),
|
||||
Multiaddr: "",
|
||||
MaxFrame: frame.FrameNumber,
|
||||
Version: consensus.GetVersion(),
|
||||
Signature: sig,
|
||||
PublicKey: e.pubSub.GetPublicKey(),
|
||||
Timestamp: timestamp,
|
||||
TotalDistance: e.dataTimeReel.GetTotalDistance().FillBytes(
|
||||
make([]byte, 256),
|
||||
),
|
||||
})
|
||||
for _, v := range e.uncooperativePeersMap {
|
||||
if v == nil {
|
||||
continue
|
||||
@ -359,12 +355,24 @@ func (e *CeremonyDataClockConsensusEngine) Start() <-chan error {
|
||||
e.peerMapMx.Unlock()
|
||||
|
||||
if e.statsClient != nil {
|
||||
peerInfo := e.GetPeerInfo()
|
||||
_, err := e.statsClient.PutPeerInfo(
|
||||
context.Background(),
|
||||
&protobufs.PutPeerInfoRequest{
|
||||
PeerInfo: peerInfo.PeerInfo,
|
||||
UncooperativePeerInfo: peerInfo.UncooperativePeerInfo,
|
||||
PeerInfo: []*protobufs.PeerInfo{
|
||||
{
|
||||
PeerId: e.pubSub.GetPeerID(),
|
||||
Multiaddrs: []string{""},
|
||||
MaxFrame: frame.FrameNumber,
|
||||
Version: consensus.GetVersion(),
|
||||
Signature: sig,
|
||||
PublicKey: e.pubSub.GetPublicKey(),
|
||||
Timestamp: timestamp,
|
||||
TotalDistance: e.dataTimeReel.GetTotalDistance().FillBytes(
|
||||
make([]byte, 256),
|
||||
),
|
||||
},
|
||||
},
|
||||
UncooperativePeerInfo: []*protobufs.PeerInfo{},
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user