fix : TestTransactionIndices, testBeaconSync

This commit is contained in:
Shivam Sharma 2023-07-04 13:41:04 +05:30
parent 2b06029fb8
commit 2ad1e0f7e9
2 changed files with 4 additions and 3 deletions

View file

@ -2798,6 +2798,8 @@ func TestTransactionIndices(t *testing.T) {
block.AddTx(tx) block.AddTx(tx)
}) })
borReceipts := make([]types.Receipts, len(receipts))
check := func(tail *uint64, chain *BlockChain) { check := func(tail *uint64, chain *BlockChain) {
stored := rawdb.ReadTxIndexTail(chain.db) stored := rawdb.ReadTxIndexTail(chain.db)
if tail == nil && stored != nil { if tail == nil && stored != nil {
@ -2841,7 +2843,7 @@ func TestTransactionIndices(t *testing.T) {
for _, l := range limit { for _, l := range limit {
frdir := t.TempDir() frdir := t.TempDir()
ancientDb, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), frdir, "", false) ancientDb, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), frdir, "", false)
_, _ = rawdb.WriteAncientBlocks(ancientDb, append([]*types.Block{gspec.ToBlock()}, blocks...), append([]types.Receipts{{}}, receipts...), []types.Receipts{nil}, big.NewInt(0)) _, _ = rawdb.WriteAncientBlocks(ancientDb, append([]*types.Block{gspec.ToBlock()}, blocks...), append([]types.Receipts{{}}, receipts...), append([]types.Receipts{{}}, borReceipts...), big.NewInt(0))
l := l l := l
@ -2867,7 +2869,7 @@ func TestTransactionIndices(t *testing.T) {
ancientDb, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), t.TempDir(), "", false) ancientDb, _ := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), t.TempDir(), "", false)
defer ancientDb.Close() defer ancientDb.Close()
_, _ = rawdb.WriteAncientBlocks(ancientDb, append([]*types.Block{gspec.ToBlock()}, blocks...), append([]types.Receipts{{}}, receipts...), []types.Receipts{nil}, big.NewInt(0)) _, _ = rawdb.WriteAncientBlocks(ancientDb, append([]*types.Block{gspec.ToBlock()}, blocks...), append([]types.Receipts{{}}, receipts...), append([]types.Receipts{{}}, borReceipts...), big.NewInt(0))
limit = []uint64{0, 64 /* drop stale */, 32 /* shorten history */, 64 /* extend history */, 0 /* restore all */} limit = []uint64{0, 64 /* drop stale */, 32 /* shorten history */, 64 /* extend history */, 0 /* restore all */}

View file

@ -1899,7 +1899,6 @@ func TestBeaconSync66Snap(t *testing.T) {
func testBeaconSync(t *testing.T, protocol uint, mode SyncMode) { func testBeaconSync(t *testing.T, protocol uint, mode SyncMode) {
t.Helper() t.Helper()
t.Parallel()
//log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true)))) //log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true))))
var cases = []struct { var cases = []struct {