lotus/chain/vm/vm_test.go
Jakub Sztandera b90f45fa60 Change build params
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2019-09-27 23:42:12 +02:00

29 lines
789 B
Go

package vm
import (
"fmt"
"math/big"
"testing"
"github.com/filecoin-project/go-lotus/build"
"github.com/filecoin-project/go-lotus/chain/types"
)
func TestBlockReward(t *testing.T) {
coffer := types.FromFil(build.MiningRewardTotal).Int
sum := new(big.Int)
N := build.HalvingPeriodBlocks
for i := 0; i < N; i++ {
a := MiningReward(types.BigInt{coffer})
sum = sum.Add(sum, a.Int)
coffer = coffer.Sub(coffer, a.Int)
}
//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)))
}