updated engine in test plugin
This commit is contained in:
parent
bb43b2cbc4
commit
7a99cf6bf0
@ -9,6 +9,7 @@ import(
|
|||||||
"github.com/openrelayxyz/plugeth-utils/restricted/types"
|
"github.com/openrelayxyz/plugeth-utils/restricted/types"
|
||||||
"github.com/openrelayxyz/plugeth-utils/restricted/hasher"
|
"github.com/openrelayxyz/plugeth-utils/restricted/hasher"
|
||||||
"github.com/openrelayxyz/plugeth-utils/restricted/consensus"
|
"github.com/openrelayxyz/plugeth-utils/restricted/consensus"
|
||||||
|
"github.com/openrelayxyz/plugeth-utils/restricted/params"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -60,6 +61,10 @@ func (e *engine) VerifyUncles(chain consensus.ChainReader, block *types.Block) e
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (e *engine) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error {
|
func (e *engine) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error {
|
||||||
|
if header.BaseFee == nil {
|
||||||
|
header.BaseFee = new(big.Int)
|
||||||
|
|
||||||
|
}
|
||||||
header.Difficulty = new(big.Int).SetUint64(123456789)
|
header.Difficulty = new(big.Int).SetUint64(123456789)
|
||||||
header.UncleHash = core.HexToHash("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347")
|
header.UncleHash = core.HexToHash("1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347")
|
||||||
return nil
|
return nil
|
||||||
@ -67,6 +72,10 @@ func (e *engine) Prepare(chain consensus.ChainHeaderReader, header *types.Header
|
|||||||
func (e *engine) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state core.RWStateDB, txs []*types.Transaction,uncles []*types.Header, withdrawals []*types.Withdrawal) {
|
func (e *engine) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state core.RWStateDB, txs []*types.Transaction,uncles []*types.Header, withdrawals []*types.Withdrawal) {
|
||||||
}
|
}
|
||||||
func (e *engine) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state core.RWStateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, withdrawals []*types.Withdrawal) (*types.Block, error) {
|
func (e *engine) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state core.RWStateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, withdrawals []*types.Withdrawal) (*types.Block, error) {
|
||||||
|
if header.BaseFee == nil {
|
||||||
|
header.BaseFee = new(big.Int)
|
||||||
|
|
||||||
|
}
|
||||||
header.Root = state.IntermediateRoot(false)
|
header.Root = state.IntermediateRoot(false)
|
||||||
hasher := hasher.NewStackTrie(nil)
|
hasher := hasher.NewStackTrie(nil)
|
||||||
block := types.NewBlockWithWithdrawals(header, txs, uncles, receipts, withdrawals, hasher)
|
block := types.NewBlockWithWithdrawals(header, txs, uncles, receipts, withdrawals, hasher)
|
||||||
@ -97,6 +106,6 @@ func (e *engine) Close() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateEngine() consensus.Engine {
|
func CreateEngine(chainConfig *params.ChainConfig, db restricted.Database) consensus.Engine {
|
||||||
return &engine{}
|
return &engine{}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user