don't go into negative remaining time

This commit is contained in:
laser 2020-06-17 10:30:16 -07:00
parent 402cd8be19
commit 791dff5a87

View File

@ -169,7 +169,11 @@ var getAskCmd = &cli.Command{
return err return err
} }
rem := time.Second * time.Duration((ask.Expiry-miningBaseTs.Height())*build.BlockDelay) dlt := ask.Expiry - miningBaseTs.Height()
rem := "<expired>"
if dlt > 0 {
rem = (time.Second * time.Duration(dlt*build.BlockDelay)).String()
}
fmt.Fprintf(w, "%s\t%s\t%s\t%d\t%s\t%d\n", ask.Price, types.SizeStr(types.NewInt(uint64(ask.MinPieceSize))), types.SizeStr(types.NewInt(uint64(ask.MaxPieceSize))), ask.Expiry, rem, ask.SeqNo) fmt.Fprintf(w, "%s\t%s\t%s\t%d\t%s\t%d\n", ask.Price, types.SizeStr(types.NewInt(uint64(ask.MinPieceSize))), types.SizeStr(types.NewInt(uint64(ask.MaxPieceSize))), ask.Expiry, rem, ask.SeqNo)