core/chain_makers: update params passed to ubqhash.AccumulateRewards and ubqhash.CalcDifficultyLegacy

This commit is contained in:
Luke Williams 2019-03-09 07:59:39 +01:00
parent 112cdc5853
commit 49a93a71e6

View file

@ -22,7 +22,6 @@ import (
"github.com/ubiq/go-ubiq/common"
"github.com/ubiq/go-ubiq/consensus/ubqhash"
"github.com/ubiq/go-ubiq/consensus/misc"
"github.com/ubiq/go-ubiq/core/state"
"github.com/ubiq/go-ubiq/core/types"
"github.com/ubiq/go-ubiq/core/vm"
@ -168,7 +167,7 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, db ethdb.Dat
if gen != nil {
gen(i, b)
}
ubqhash.AccumulateRewards(config, statedb, h, b.uncles)
ubqhash.AccumulateRewards(statedb, h, b.uncles)
root, err := statedb.CommitTo(db, config.IsEIP158(h.Number))
if err != nil {
panic(fmt.Sprintf("state write error: %v", err))
@ -202,12 +201,7 @@ func makeHeader(config *params.ChainConfig, parent *types.Block, state *state.St
Root: state.IntermediateRoot(config.IsEIP158(parent.Number())),
ParentHash: parent.Hash(),
Coinbase: parent.Coinbase(),
Difficulty: ubqhash.CalcDifficultyLegacy(config, time.Uint64(), &types.Header{
Number: parent.Number(),
Time: new(big.Int).Sub(time, big.NewInt(10)),
Difficulty: parent.Difficulty(),
UncleHash: parent.UncleHash(),
}),
Difficulty: ubqhash.CalcDifficultyLegacy(time.Uint64(), new(big.Int).Sub(time, big.NewInt(10)).Uint64(), parent.Number(), parent.Difficulty()),
GasLimit: CalcGasLimit(parent),
GasUsed: new(big.Int),
Number: new(big.Int).Add(parent.Number(), common.Big1),