Merge pull request #2093 from filecoin-project/asr/clarify

Clarify expected block win when below minimum power threshold
This commit is contained in:
Łukasz Magiera 2020-06-22 22:32:08 +02:00 committed by GitHub
commit 9f3145aec0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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()