mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 10:27:26 +08:00
refined to work across the board
This commit is contained in:
parent
8a26318e1a
commit
28e8331ca1
@ -251,8 +251,7 @@ func (e *DataClockConsensusEngine) GetAheadPeers(frameNumber uint64) []internal.
|
||||
if v.timestamp <= config.GetMinimumVersionCutoff().UnixMilli() {
|
||||
continue
|
||||
}
|
||||
if bytes.Compare(v.version, config.GetMinimumVersion()) < 0 ||
|
||||
v.patchVersion < config.GetMinimumPatchVersion() {
|
||||
if bytes.Compare(v.version, config.GetMinimumVersion()) < 0 {
|
||||
continue
|
||||
}
|
||||
maxDiff = max(maxDiff, v.maxFrame-frameNumber)
|
||||
|
||||
@ -121,7 +121,9 @@ type DataClockConsensusEngine struct {
|
||||
dependencyMapMx sync.Mutex
|
||||
stagedTransactions *protobufs.TokenRequests
|
||||
stagedTransactionsSet map[string]struct{}
|
||||
stagedTransactionsMx sync.RWMutex
|
||||
stagedTransactionsMx sync.Mutex
|
||||
validationFilter map[string]struct{}
|
||||
validationFilterMx sync.Mutex
|
||||
peerMapMx sync.RWMutex
|
||||
peerAnnounceMapMx sync.Mutex
|
||||
lastKeyBundleAnnouncementFrame uint64
|
||||
@ -270,8 +272,8 @@ func NewDataClockConsensusEngine(
|
||||
rateLimit,
|
||||
time.Minute,
|
||||
),
|
||||
requestSyncCh: make(chan struct{}, 1),
|
||||
stagedTransactionsSet: map[string]struct{}{},
|
||||
requestSyncCh: make(chan struct{}, 1),
|
||||
validationFilter: map[string]struct{}{},
|
||||
}
|
||||
|
||||
logger.Info("constructing consensus engine")
|
||||
|
||||
@ -145,6 +145,9 @@ func (e *DataClockConsensusEngine) runLoop() {
|
||||
case <-e.ctx.Done():
|
||||
return
|
||||
case dataFrame := <-dataFrameCh:
|
||||
e.validationFilterMx.Lock()
|
||||
e.validationFilter = make(map[string]struct{}, len(e.validationFilter))
|
||||
e.validationFilterMx.Unlock()
|
||||
if e.GetFrameProverTries()[0].Contains(e.provingKeyAddress) {
|
||||
if err = e.publishProof(dataFrame); err != nil {
|
||||
e.logger.Error("could not publish", zap.Error(err))
|
||||
|
||||
@ -83,9 +83,10 @@ func (e *DataClockConsensusEngine) validateTxMessage(peerID peer.ID, message *pb
|
||||
frameNumber,
|
||||
mint.Signature.PublicKey.KeyValue,
|
||||
)
|
||||
e.stagedTransactionsMx.RLock()
|
||||
_, ok := e.stagedTransactionsSet[id]
|
||||
e.stagedTransactionsMx.RUnlock()
|
||||
e.validationFilterMx.Lock()
|
||||
_, ok := e.validationFilter[id]
|
||||
e.validationFilter[id] = struct{}{}
|
||||
e.validationFilterMx.Unlock()
|
||||
if ok {
|
||||
e.pubSub.AddPeerScore([]byte(peerID), -1000000)
|
||||
return p2p.ValidationResultReject
|
||||
|
||||
Loading…
Reference in New Issue
Block a user