Skip to content

Commit

Permalink
Try #2337:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] committed Mar 20, 2021
2 parents c8c61a4 + a3d7e46 commit 1df3c82
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tortoise/ninja_tortoise.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,16 @@ func getIdsFromSet(bids map[types.BlockID]struct{}) patternID {
func (ni *ninjaTortoise) globalOpinion(v vec, layerSize int, delta float64) vec {
threshold := globalThreshold * delta * float64(layerSize)
ni.logger.With().Debug("global opinion", v, log.String("threshold", fmt.Sprint(threshold)))
if float64(v[0]) > threshold {

// calculate net support
netSupport := v[0] - v[1]

if float64(netSupport) > threshold {
return support
} else if float64(v[1]) > threshold {
} else if float64(netSupport) < -1*threshold {
return against
} else {
// in future, use weak coin here for self-healing
return abstain
}
}
Expand Down

0 comments on commit 1df3c82

Please sign in to comment.