tests/difficulty_test_util: CalcDifficulty -> CalcDifficultyLegacy

This commit is contained in:
Luke Williams 2019-03-09 10:12:55 +01:00
parent a9c5e808a6
commit c8394400c6

View file

@ -24,7 +24,7 @@ import (
"github.com/ubiq/go-ubiq/common"
"github.com/ubiq/go-ubiq/common/math"
"github.com/ubiq/go-ubiq/consensus/ubqhash"
"github.com/ubiq/go-ubiq/core/types"
//"github.com/ubiq/go-ubiq/core/types"
"github.com/ubiq/go-ubiq/params"
)
@ -50,14 +50,14 @@ type difficultyTestMarshaling struct {
func (test *DifficultyTest) Run(config *params.ChainConfig) error {
parentNumber := big.NewInt(int64(test.CurrentBlockNumber - 1))
parent := &types.Header{
/*parent := &types.Header{
Difficulty: test.ParentDifficulty,
Time: test.ParentTimestamp,
Number: parentNumber,
UncleHash: test.UncleHash,
}
}*/
actual := ubqhash.CalcDifficulty(config, test.CurrentTimestamp.Uint64(), parent)
actual := ubqhash.CalcDifficultyLegacy(test.CurrentTimestamp.Uint64(), test.ParentTimestamp.Uint64(), parentNumber, test.ParentDifficulty)
exp := test.CurrentDifficulty
if actual.Cmp(exp) != 0 {