Clarify expected block win when below minimum power threshold

This commit is contained in:
Aayush Rajasekaran 2020-06-22 11:42:26 -04:00
parent 596ed330dd
commit 4959596527

View File

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"context" "context"
"fmt" "fmt"
"github.com/filecoin-project/specs-actors/actors/builtin/power"
"sort" "sort"
"time" "time"
@ -119,16 +120,20 @@ var infoCmd = &cli.Command{
faultyPercentage) faultyPercentage)
} }
expWinChance := float64(types.BigMul(qpercI, types.NewInt(build.BlocksPerEpoch)).Int64()) / 1000000 if pow.MinerPower.RawBytePower.LessThan(power.ConsensusMinerMinPower) {
if expWinChance > 0 { fmt.Print("Below minimum power threshold, no blocks will be won")
if expWinChance > 1 { } else {
expWinChance = 1 expWinChance := float64(types.BigMul(qpercI, types.NewInt(build.BlocksPerEpoch)).Int64()) / 1000000
} if expWinChance > 0 {
winRate := time.Duration(float64(time.Second*build.BlockDelay) / expWinChance) if expWinChance > 1 {
winPerDay := float64(time.Hour*24) / float64(winRate) expWinChance = 1
}
winRate := time.Duration(float64(time.Second*build.BlockDelay) / expWinChance)
winPerDay := float64(time.Hour*24) / float64(winRate)
fmt.Print("Expected block win rate: ") fmt.Print("Expected block win rate: ")
color.Blue("%.4f/day (every %s)", winPerDay, winRate.Truncate(time.Second)) color.Blue("%.4f/day (every %s)", winPerDay, winRate.Truncate(time.Second))
}
} }
fmt.Println() fmt.Println()