From d5b76d4aa4d7194598c93307a48ac3a1ccbeacce Mon Sep 17 00:00:00 2001 From: Arpit Temani Date: Mon, 11 Apr 2022 23:00:53 +0530 Subject: [PATCH] fix failing tests --- core/genesis_test.go | 30 ------------------------------ miner/miner_test.go | 2 +- miner/worker_test.go | 2 +- 3 files changed, 2 insertions(+), 32 deletions(-) diff --git a/core/genesis_test.go b/core/genesis_test.go index cf49de7ff1..e8010e3d4e 100644 --- a/core/genesis_test.go +++ b/core/genesis_test.go @@ -243,33 +243,3 @@ func TestReadWriteGenesisAlloc(t *testing.T) { } } } - -func TestGenesis_Commit(t *testing.T) { - genesis := &Genesis{ - BaseFee: big.NewInt(params.InitialBaseFee), - Config: params.TestChainConfig, - // difficulty is nil - } - - db := rawdb.NewMemoryDatabase() - genesisBlock, err := genesis.Commit(db) - if err != nil { - t.Fatal(err) - } - - if genesis.Difficulty != nil { - t.Fatalf("assumption wrong") - } - - // This value should have been set as default in the ToBlock method. - if genesisBlock.Difficulty().Cmp(params.GenesisDifficulty) != 0 { - t.Errorf("assumption wrong: want: %d, got: %v", params.GenesisDifficulty, genesisBlock.Difficulty()) - } - - // Expect the stored total difficulty to be the difficulty of the genesis block. - stored := rawdb.ReadTd(db, genesisBlock.Hash(), genesisBlock.NumberU64()) - - if stored.Cmp(genesisBlock.Difficulty()) != 0 { - t.Errorf("inequal difficulty; stored: %v, genesisBlock: %v", stored, genesisBlock.Difficulty()) - } -} diff --git a/miner/miner_test.go b/miner/miner_test.go index 56773101be..03c79cbbd5 100644 --- a/miner/miner_test.go +++ b/miner/miner_test.go @@ -258,7 +258,7 @@ func createMiner(t *testing.T) (*Miner, *event.TypeMux, func(skipMiner bool)) { // Create consensus engine engine := clique.New(chainConfig.Clique, chainDB) // Create Ethereum backend - merger := consensus.NewMerger(rawdb.NewMemoryDatabase()) + consensus.NewMerger(rawdb.NewMemoryDatabase()) bc, err := core.NewBlockChain(chainDB, nil, chainConfig, engine, vm.Config{}, nil, nil) if err != nil { t.Fatalf("can't create new chain %v", err) diff --git a/miner/worker_test.go b/miner/worker_test.go index f309ae994b..dd029433b8 100644 --- a/miner/worker_test.go +++ b/miner/worker_test.go @@ -202,7 +202,7 @@ func (b *testWorkerBackend) newRandomTx(creation bool) *types.Transaction { func newTestWorker(t *testing.T, chainConfig *params.ChainConfig, engine consensus.Engine, db ethdb.Database, blocks int) (*worker, *testWorkerBackend) { backend := newTestWorkerBackend(t, chainConfig, engine, db, blocks) backend.txPool.AddLocals(pendingTxs) - w := newWorker(testConfig, chainConfig, engine, backend, new(event.TypeMux), nil, false, consensus.NewMerger(rawdb.NewMemoryDatabase())) + w := newWorker(testConfig, chainConfig, engine, backend, new(event.TypeMux), nil, false) w.setEtherbase(testBankAddress) return w, backend }