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")
|
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 {
|
for _, p := range announce.PeerList {
|
||||||
e.peerMapMx.Lock()
|
e.peerMapMx.Lock()
|
||||||
if _, ok := e.uncooperativePeersMap[string(p.PeerId)]; ok {
|
if _, ok := e.uncooperativePeersMap[string(p.PeerId)]; ok {
|
||||||
|
@ -101,7 +101,6 @@ type CeremonyDataClockConsensusEngine struct {
|
|||||||
peerMapMx sync.Mutex
|
peerMapMx sync.Mutex
|
||||||
peerAnnounceMapMx sync.Mutex
|
peerAnnounceMapMx sync.Mutex
|
||||||
lastKeyBundleAnnouncementFrame uint64
|
lastKeyBundleAnnouncementFrame uint64
|
||||||
peerAnnounceMap map[string]*protobufs.CeremonyPeerListAnnounce
|
|
||||||
peerMap map[string]*peerInfo
|
peerMap map[string]*peerInfo
|
||||||
uncooperativePeersMap map[string]*peerInfo
|
uncooperativePeersMap map[string]*peerInfo
|
||||||
}
|
}
|
||||||
@ -227,7 +226,6 @@ func NewCeremonyDataClockConsensusEngine(
|
|||||||
frameProverTrie: &tries.RollingFrecencyCritbitTrie{},
|
frameProverTrie: &tries.RollingFrecencyCritbitTrie{},
|
||||||
inclusionProver: inclusionProver,
|
inclusionProver: inclusionProver,
|
||||||
syncingStatus: SyncStatusNotSyncing,
|
syncingStatus: SyncStatusNotSyncing,
|
||||||
peerAnnounceMap: map[string]*protobufs.CeremonyPeerListAnnounce{},
|
|
||||||
peerMap: map[string]*peerInfo{},
|
peerMap: map[string]*peerInfo{},
|
||||||
uncooperativePeersMap: map[string]*peerInfo{},
|
uncooperativePeersMap: map[string]*peerInfo{},
|
||||||
minimumPeersRequired: minimumPeersRequired,
|
minimumPeersRequired: minimumPeersRequired,
|
||||||
@ -330,20 +328,18 @@ func (e *CeremonyDataClockConsensusEngine) Start() <-chan error {
|
|||||||
),
|
),
|
||||||
}
|
}
|
||||||
deletes := []*peerInfo{}
|
deletes := []*peerInfo{}
|
||||||
for _, v := range e.peerMap {
|
|
||||||
list.PeerList = append(list.PeerList, &protobufs.CeremonyPeer{
|
list.PeerList = append(list.PeerList, &protobufs.CeremonyPeer{
|
||||||
PeerId: v.peerId,
|
PeerId: e.pubSub.GetPeerID(),
|
||||||
Multiaddr: v.multiaddr,
|
Multiaddr: "",
|
||||||
MaxFrame: v.maxFrame,
|
MaxFrame: frame.FrameNumber,
|
||||||
Timestamp: v.timestamp,
|
Version: consensus.GetVersion(),
|
||||||
Version: v.version,
|
Signature: sig,
|
||||||
Signature: v.signature,
|
PublicKey: e.pubSub.GetPublicKey(),
|
||||||
PublicKey: v.publicKey,
|
Timestamp: timestamp,
|
||||||
TotalDistance: e.dataTimeReel.GetTotalDistance().FillBytes(
|
TotalDistance: e.dataTimeReel.GetTotalDistance().FillBytes(
|
||||||
make([]byte, 256),
|
make([]byte, 256),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
}
|
|
||||||
for _, v := range e.uncooperativePeersMap {
|
for _, v := range e.uncooperativePeersMap {
|
||||||
if v == nil {
|
if v == nil {
|
||||||
continue
|
continue
|
||||||
@ -359,12 +355,24 @@ func (e *CeremonyDataClockConsensusEngine) Start() <-chan error {
|
|||||||
e.peerMapMx.Unlock()
|
e.peerMapMx.Unlock()
|
||||||
|
|
||||||
if e.statsClient != nil {
|
if e.statsClient != nil {
|
||||||
peerInfo := e.GetPeerInfo()
|
|
||||||
_, err := e.statsClient.PutPeerInfo(
|
_, err := e.statsClient.PutPeerInfo(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
&protobufs.PutPeerInfoRequest{
|
&protobufs.PutPeerInfoRequest{
|
||||||
PeerInfo: peerInfo.PeerInfo,
|
PeerInfo: []*protobufs.PeerInfo{
|
||||||
UncooperativePeerInfo: peerInfo.UncooperativePeerInfo,
|
{
|
||||||
|
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 {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user