2019-09-21 00:22:28 +00:00
|
|
|
package vm
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2019-09-27 21:42:12 +00:00
|
|
|
"math/big"
|
2019-09-21 00:22:28 +00:00
|
|
|
"testing"
|
|
|
|
|
2019-10-18 04:47:41 +00:00
|
|
|
"github.com/filecoin-project/lotus/build"
|
|
|
|
"github.com/filecoin-project/lotus/chain/types"
|
2020-02-07 07:01:37 +00:00
|
|
|
|
|
|
|
_ "github.com/filecoin-project/lotus/lib/sigs/secp"
|
2019-09-21 00:22:28 +00:00
|
|
|
)
|
|
|
|
|
2019-12-11 16:27:30 +00:00
|
|
|
const HalvingPeriodEpochs = 6 * 365 * 24 * 60 * 2
|
|
|
|
|
2019-09-21 00:22:28 +00:00
|
|
|
func TestBlockReward(t *testing.T) {
|
2020-03-03 23:01:35 +00:00
|
|
|
t.Skip()
|
2019-09-27 21:42:12 +00:00
|
|
|
coffer := types.FromFil(build.MiningRewardTotal).Int
|
|
|
|
sum := new(big.Int)
|
2019-12-11 16:27:30 +00:00
|
|
|
N := HalvingPeriodEpochs
|
2019-09-26 22:33:38 +00:00
|
|
|
for i := 0; i < N; i++ {
|
2019-09-27 21:42:12 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2019-09-26 22:33:38 +00:00
|
|
|
//sum = types.BigMul(sum, types.NewInt(60))
|
|
|
|
|
|
|
|
fmt.Println("After a halving period")
|
|
|
|
fmt.Printf("Total reward: %d\n", build.MiningRewardTotal)
|
2019-09-27 21:42:12 +00:00
|
|
|
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
|
|
|
}
|