mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
fix and simplify history test historyPruneErr check
This commit is contained in:
parent
b0eaf5f6b0
commit
72a6e23dfa
1 changed files with 8 additions and 40 deletions
|
|
@ -108,11 +108,7 @@ func (s *historyTestSuite) testGetBlockByHash(t *utesting.T) {
|
||||||
for i, num := range s.tests.BlockNumbers {
|
for i, num := range s.tests.BlockNumbers {
|
||||||
bhash := s.tests.BlockHashes[i]
|
bhash := s.tests.BlockHashes[i]
|
||||||
b, err := s.cfg.client.getBlockByHash(ctx, bhash, false)
|
b, err := s.cfg.client.getBlockByHash(ctx, bhash, false)
|
||||||
if err != nil {
|
if err = validateHistoryPruneErr(err, num, s.cfg); err != nil {
|
||||||
err = validateHistoryPruneErr(err, num, s.cfg)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
|
t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
|
||||||
}
|
}
|
||||||
if b == nil {
|
if b == nil {
|
||||||
|
|
@ -131,11 +127,7 @@ func (s *historyTestSuite) testGetBlockByNumber(t *utesting.T) {
|
||||||
for i, num := range s.tests.BlockNumbers {
|
for i, num := range s.tests.BlockNumbers {
|
||||||
bhash := s.tests.BlockHashes[i]
|
bhash := s.tests.BlockHashes[i]
|
||||||
b, err := s.cfg.client.getBlockByNumber(ctx, num, false)
|
b, err := s.cfg.client.getBlockByNumber(ctx, num, false)
|
||||||
if err != nil {
|
if err = validateHistoryPruneErr(err, num, s.cfg); err != nil {
|
||||||
err = validateHistoryPruneErr(err, num, s.cfg)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
|
t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
|
||||||
}
|
}
|
||||||
if b == nil {
|
if b == nil {
|
||||||
|
|
@ -154,11 +146,7 @@ func (s *historyTestSuite) testGetBlockTransactionCountByHash(t *utesting.T) {
|
||||||
for i, num := range s.tests.BlockNumbers {
|
for i, num := range s.tests.BlockNumbers {
|
||||||
bhash := s.tests.BlockHashes[i]
|
bhash := s.tests.BlockHashes[i]
|
||||||
count, err := s.cfg.client.getBlockTransactionCountByHash(ctx, bhash)
|
count, err := s.cfg.client.getBlockTransactionCountByHash(ctx, bhash)
|
||||||
if err != nil {
|
if err = validateHistoryPruneErr(err, num, s.cfg); err != nil {
|
||||||
err = validateHistoryPruneErr(err, num, s.cfg)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
|
t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
|
||||||
}
|
}
|
||||||
expectedCount := uint64(s.tests.TxCounts[i])
|
expectedCount := uint64(s.tests.TxCounts[i])
|
||||||
|
|
@ -174,11 +162,7 @@ func (s *historyTestSuite) testGetBlockTransactionCountByNumber(t *utesting.T) {
|
||||||
for i, num := range s.tests.BlockNumbers {
|
for i, num := range s.tests.BlockNumbers {
|
||||||
bhash := s.tests.BlockHashes[i]
|
bhash := s.tests.BlockHashes[i]
|
||||||
count, err := s.cfg.client.getBlockTransactionCountByNumber(ctx, num)
|
count, err := s.cfg.client.getBlockTransactionCountByNumber(ctx, num)
|
||||||
if err != nil {
|
if err = validateHistoryPruneErr(err, num, s.cfg); err != nil {
|
||||||
err = validateHistoryPruneErr(err, num, s.cfg)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
|
t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
|
||||||
}
|
}
|
||||||
expectedCount := uint64(s.tests.TxCounts[i])
|
expectedCount := uint64(s.tests.TxCounts[i])
|
||||||
|
|
@ -194,11 +178,7 @@ func (s *historyTestSuite) testGetBlockReceiptsByHash(t *utesting.T) {
|
||||||
for i, num := range s.tests.BlockNumbers {
|
for i, num := range s.tests.BlockNumbers {
|
||||||
bhash := s.tests.BlockHashes[i]
|
bhash := s.tests.BlockHashes[i]
|
||||||
receipts, err := s.cfg.client.getBlockReceipts(ctx, bhash)
|
receipts, err := s.cfg.client.getBlockReceipts(ctx, bhash)
|
||||||
if err != nil {
|
if err = validateHistoryPruneErr(err, num, s.cfg); err != nil {
|
||||||
err = validateHistoryPruneErr(err, num, s.cfg)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
|
t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
|
||||||
}
|
}
|
||||||
hash := calcReceiptsHash(receipts)
|
hash := calcReceiptsHash(receipts)
|
||||||
|
|
@ -215,11 +195,7 @@ func (s *historyTestSuite) testGetBlockReceiptsByNumber(t *utesting.T) {
|
||||||
for i, num := range s.tests.BlockNumbers {
|
for i, num := range s.tests.BlockNumbers {
|
||||||
bhash := s.tests.BlockHashes[i]
|
bhash := s.tests.BlockHashes[i]
|
||||||
receipts, err := s.cfg.client.getBlockReceipts(ctx, hexutil.Uint64(num))
|
receipts, err := s.cfg.client.getBlockReceipts(ctx, hexutil.Uint64(num))
|
||||||
if err != nil {
|
if err = validateHistoryPruneErr(err, num, s.cfg); err != nil {
|
||||||
err = validateHistoryPruneErr(err, num, s.cfg)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
|
t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
|
||||||
}
|
}
|
||||||
hash := calcReceiptsHash(receipts)
|
hash := calcReceiptsHash(receipts)
|
||||||
|
|
@ -242,11 +218,7 @@ func (s *historyTestSuite) testGetTransactionByBlockHashAndIndex(t *utesting.T)
|
||||||
}
|
}
|
||||||
|
|
||||||
tx, err := s.cfg.client.getTransactionByBlockHashAndIndex(ctx, bhash, uint64(txIndex))
|
tx, err := s.cfg.client.getTransactionByBlockHashAndIndex(ctx, bhash, uint64(txIndex))
|
||||||
if err != nil {
|
if err = validateHistoryPruneErr(err, num, s.cfg); err != nil {
|
||||||
err = validateHistoryPruneErr(err, num, s.cfg)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
|
t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
|
||||||
}
|
}
|
||||||
if tx == nil {
|
if tx == nil {
|
||||||
|
|
@ -271,11 +243,7 @@ func (s *historyTestSuite) testGetTransactionByBlockNumberAndIndex(t *utesting.T
|
||||||
}
|
}
|
||||||
|
|
||||||
tx, err := s.cfg.client.getTransactionByBlockNumberAndIndex(ctx, num, uint64(txIndex))
|
tx, err := s.cfg.client.getTransactionByBlockNumberAndIndex(ctx, num, uint64(txIndex))
|
||||||
if err != nil {
|
if err = validateHistoryPruneErr(err, num, s.cfg); err != nil {
|
||||||
err = validateHistoryPruneErr(err, num, s.cfg)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
|
t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
|
||||||
}
|
}
|
||||||
if tx == nil {
|
if tx == nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue