forked from cerc-io/plugeth
all: cleanup tests (#25641)
Follow-up to PR #25523 to cleanup all relevant tests.
This commit is contained in:
@@ -30,7 +30,6 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/eth"
|
||||
@@ -238,7 +237,6 @@ func newTestBackend(t *testing.T) (*node.Node, []*types.Block) {
|
||||
}
|
||||
|
||||
func generateTestChain() []*types.Block {
|
||||
db := rawdb.NewMemoryDatabase()
|
||||
generate := func(i int, g *core.BlockGen) {
|
||||
g.OffsetTime(5)
|
||||
g.SetExtra([]byte("test"))
|
||||
@@ -248,11 +246,8 @@ func generateTestChain() []*types.Block {
|
||||
g.AddTx(testTx2)
|
||||
}
|
||||
}
|
||||
gblock := genesis.MustCommit(db)
|
||||
engine := ethash.NewFaker()
|
||||
blocks, _ := core.GenerateChain(genesis.Config, gblock, engine, db, 2, generate)
|
||||
blocks = append([]*types.Block{gblock}, blocks...)
|
||||
return blocks
|
||||
_, blocks, _ := core.GenerateChainWithGenesis(genesis, ethash.NewFaker(), 2, generate)
|
||||
return append([]*types.Block{genesis.ToBlock()}, blocks...)
|
||||
}
|
||||
|
||||
func TestEthClient(t *testing.T) {
|
||||
|
||||
@@ -26,7 +26,6 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/eth"
|
||||
@@ -78,10 +77,8 @@ func newTestBackend(t *testing.T) (*node.Node, []*types.Block) {
|
||||
}
|
||||
|
||||
func generateTestChain() (*core.Genesis, []*types.Block) {
|
||||
db := rawdb.NewMemoryDatabase()
|
||||
config := params.AllEthashProtocolChanges
|
||||
genesis := &core.Genesis{
|
||||
Config: config,
|
||||
Config: params.AllEthashProtocolChanges,
|
||||
Alloc: core.GenesisAlloc{testAddr: {Balance: testBalance, Storage: map[common.Hash]common.Hash{testSlot: testValue}}},
|
||||
ExtraData: []byte("test genesis"),
|
||||
Timestamp: 9000,
|
||||
@@ -90,10 +87,8 @@ func generateTestChain() (*core.Genesis, []*types.Block) {
|
||||
g.OffsetTime(5)
|
||||
g.SetExtra([]byte("test"))
|
||||
}
|
||||
gblock := genesis.MustCommit(db)
|
||||
engine := ethash.NewFaker()
|
||||
blocks, _ := core.GenerateChain(config, gblock, engine, db, 1, generate)
|
||||
blocks = append([]*types.Block{gblock}, blocks...)
|
||||
_, blocks, _ := core.GenerateChainWithGenesis(genesis, ethash.NewFaker(), 1, generate)
|
||||
blocks = append([]*types.Block{genesis.ToBlock()}, blocks...)
|
||||
return genesis, blocks
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user