diff --git a/config/config.go b/config/config.go index 44536521d0..08fcaa2e72 100644 --- a/config/config.go +++ b/config/config.go @@ -858,8 +858,8 @@ type OracleConfig struct { // DefaultOracleConfig returns a default configuration for the CometBFT oracle service func DefaultOracleConfig() *OracleConfig { return &OracleConfig{ - MaxOracleGossipBlocksDelayed: 2, // keep all gossipVotes from at most 2 blocks behind - MaxOracleGossipAge: 15, // keep all gossipVotes from at most 15s ago + MaxOracleGossipBlocksDelayed: 3, // keep all gossipVotes from at most 3 blocks behind + MaxOracleGossipAge: 20, // keep all gossipVotes from at most 20s ago SignInterval: 100 * time.Millisecond, // 0.1s GossipInterval: 100 * time.Millisecond, // 0.1s PruneInterval: 500 * time.Millisecond, // 0.5s diff --git a/oracle/service/runner/runner.go b/oracle/service/runner/runner.go index 595b903abb..fdf551b269 100644 --- a/oracle/service/runner/runner.go +++ b/oracle/service/runner/runner.go @@ -2,6 +2,7 @@ package runner import ( "context" + "fmt" "sort" "time" @@ -125,7 +126,17 @@ func PruneVoteBuffers(oracleInfo *types.OracleInfo, consensusState *cs.State) { oracleInfo.UnsignedVoteBuffer.UpdateMtx.Lock() newVotes := []*oracleproto.Vote{} unsignedVoteBuffer := oracleInfo.UnsignedVoteBuffer.Buffer + visitedVoteMap := make(map[string]struct{}) for _, vote := range unsignedVoteBuffer { + // check for dup votes + key := fmt.Sprintf("%v:%v", vote.Timestamp, vote.OracleId) + _, exists := visitedVoteMap[key] + if exists { + continue + } + + visitedVoteMap[key] = struct{}{} + if vote.Timestamp >= latestAllowableTimestamp { newVotes = append(newVotes, vote) }