From b605c3848e0fdfbf96bb58c56b8ff1bfd718aabd Mon Sep 17 00:00:00 2001 From: Raneet Debnath Date: Tue, 4 Jul 2023 19:16:19 +0530 Subject: [PATCH] core,eth: fix TestDeduplication, TestSyncAccountPerformance, TestTraceTransaction --- core/txpool/txpool_test.go | 4 ++-- eth/protocols/snap/sync_test.go | 3 +-- eth/tracers/api.go | 2 ++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/txpool/txpool_test.go b/core/txpool/txpool_test.go index 45e38e8a71..e2da634e13 100644 --- a/core/txpool/txpool_test.go +++ b/core/txpool/txpool_test.go @@ -2383,7 +2383,7 @@ func TestDeduplication(t *testing.T) { errs := pool.AddRemotesSync(firsts) - if len(errs) != 0 { + if len(errs) != len(firsts) { t.Fatalf("first add mismatching result count: have %d, want %d", len(errs), 0) } @@ -2405,7 +2405,7 @@ func TestDeduplication(t *testing.T) { // Try to add all of them now and ensure previous ones error out as knowns errs = pool.AddRemotesSync(txs) - if len(errs) != 0 { + if len(errs) != len(txs) { t.Fatalf("all add mismatching result count: have %d, want %d", len(errs), 0) } diff --git a/eth/protocols/snap/sync_test.go b/eth/protocols/snap/sync_test.go index f640ca7d4b..8005945d48 100644 --- a/eth/protocols/snap/sync_test.go +++ b/eth/protocols/snap/sync_test.go @@ -1529,10 +1529,9 @@ func makeAccountTrieNoStorage(n int) (string, *trie.Trie, entrySlice) { var ( db = trie.NewDatabase(rawdb.NewMemoryDatabase()) accTrie = trie.NewEmpty(db) + entries entrySlice ) - entries := make(entrySlice, uint64(n)) - for i := uint64(1); i <= uint64(n); i++ { value, _ := rlp.EncodeToBytes(&types.StateAccount{ Nonce: i, diff --git a/eth/tracers/api.go b/eth/tracers/api.go index 9aae926060..fb20d52e19 100644 --- a/eth/tracers/api.go +++ b/eth/tracers/api.go @@ -1193,6 +1193,8 @@ func (api *API) TraceTransaction(ctx context.Context, hash common.Hash, config * return ðapi.ExecutionResult{ StructLogs: make([]ethapi.StructLogRes, 0), }, nil + } else { + return nil, errTxNotFound } }