lotus/chain/vm/vm_test.go

29 lines
783 B
Go
Raw Normal View History

2019-09-21 00:22:28 +00:00
package vm
import (
"fmt"
"math/big"
2019-09-21 00:22:28 +00:00
"testing"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/types"
2019-09-21 00:22:28 +00:00
)
func TestBlockReward(t *testing.T) {
coffer := types.FromFil(build.MiningRewardTotal).Int
sum := new(big.Int)
2019-11-28 12:46:56 +00:00
N := build.HalvingPeriodEpochs
for i := 0; i < N; i++ {
a := MiningReward(types.BigInt{coffer})
sum = sum.Add(sum, a.Int)
coffer = coffer.Sub(coffer, a.Int)
2019-09-21 00:22:28 +00:00
}
//sum = types.BigMul(sum, types.NewInt(60))
fmt.Println("After a halving period")
fmt.Printf("Total reward: %d\n", build.MiningRewardTotal)
fmt.Printf("Remaining: %s\n", types.BigDiv(types.BigInt{coffer}, types.NewInt(build.FilecoinPrecision)))
fmt.Printf("Given out: %s\n", types.BigDiv(types.BigInt{sum}, types.NewInt(build.FilecoinPrecision)))
2019-09-21 00:22:28 +00:00
}