aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/compaction-chain.go13
-rw-r--r--core/consensus.go5
2 files changed, 18 insertions, 0 deletions
diff --git a/core/compaction-chain.go b/core/compaction-chain.go
index 8e04429..b0bc236 100644
--- a/core/compaction-chain.go
+++ b/core/compaction-chain.go
@@ -207,6 +207,19 @@ func (cc *compactionChain) processFinalizedBlock(block *types.Block) error {
return nil
}
+func (cc *compactionChain) firstBlockRandomnessResult(
+ rand *types.BlockRandomnessResult) bool {
+ cc.lock.RLock()
+ defer cc.lock.RUnlock()
+ if _, exist := cc.pendingRandomness[rand.BlockHash]; exist {
+ return false
+ }
+ if _, exist := cc.blockRandomness[rand.BlockHash]; exist {
+ return false
+ }
+ return true
+}
+
func (cc *compactionChain) processBlockRandomnessResult(
rand *types.BlockRandomnessResult) error {
ok, err := cc.verifyRandomness(
diff --git a/core/consensus.go b/core/consensus.go
index 3a27b5f..223e5df 100644
--- a/core/consensus.go
+++ b/core/consensus.go
@@ -1095,6 +1095,11 @@ func (con *Consensus) ProcessBlockRandomnessResult(
if rand.Position.Round == 0 {
return nil
}
+ if needBroadcast {
+ if !con.ccModule.firstBlockRandomnessResult(rand) {
+ needBroadcast = false
+ }
+ }
if err := con.ccModule.processBlockRandomnessResult(rand); err != nil {
if err == ErrBlockNotRegistered {
err = nil