Merge pull request #9182 from filecoin-project/jen/9169

fix: ux: exclude negative available balance from spendable amount
This commit is contained in:
Jiaying Wang
2022-08-18 14:44:56 -04:00
committed by GitHub
+4 -1
View File
@@ -292,7 +292,10 @@ func handleMiningInfo(ctx context.Context, cctx *cli.Context, fullapi v0api.Full
if err != nil {
return xerrors.Errorf("getting available balance: %w", err)
}
spendable = big.Add(spendable, availBalance)
if availBalance.GreaterThan(big.Zero()) {
spendable = big.Add(spendable, availBalance)
}
fmt.Printf("Miner Balance: %s\n", color.YellowString("%s", types.FIL(mact.Balance).Short()))
fmt.Printf(" PreCommit: %s\n", types.FIL(lockedFunds.PreCommitDeposits).Short())