Skip to content

Commit 0f9b2ab

Browse files
committed
wip
1 parent c3dbf08 commit 0f9b2ab

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

ethreceipts/ethreceipts.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"errors"
66
"fmt"
7-
stdlog "log"
87
"log/slog"
98
"math/big"
109
"runtime/debug"
@@ -457,7 +456,6 @@ func (l *ReceiptsListener) FetchTransactionReceiptWithFilter(ctx context.Context
457456
// it indicates that we have high conviction that the receipt should be available, as the monitor has found
458457
// this transaction hash.
459458
func (l *ReceiptsListener) fetchTransactionReceipt(ctx context.Context, txnHash common.Hash, forceFetch bool) (*types.Receipt, error) {
460-
stdlog.Printf("ethreceipts: fetchTransactionReceipt %s (forceFetch=%v)", txnHash.String(), forceFetch)
461459

462460
l.fetchSem <- struct{}{}
463461

@@ -755,8 +753,6 @@ func (l *ReceiptsListener) processBlocks(blocks ethmonitor.Blocks, subscribers [
755753

756754
// check each block against each subscriber X filter
757755
for _, block := range blocks {
758-
stdlog.Printf("ethreceipts: block[%d] -> filterers %d subscribers %d", block.Block.Number(), len(filterers), len(subscribers))
759-
760756
// report if the txn was removed
761757
reorged := block.Event == ethmonitor.Removed
762758

@@ -806,7 +802,7 @@ func (l *ReceiptsListener) processBlocks(blocks ethmonitor.Blocks, subscribers [
806802
}()
807803

808804
// retry pending receipts first
809-
retryCtx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
805+
retryCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
810806
sub.retryPendingReceipts(retryCtx)
811807
cancel()
812808

@@ -882,7 +878,6 @@ func (l *ReceiptsListener) searchFilterOnChain(ctx context.Context, subscriber *
882878
return nil
883879
}
884880
if r == nil {
885-
panic("ethreceipts: unexpected nil receipt with no error")
886881
// unable to find the receipt on-chain, lets continue
887882
return nil
888883
}
@@ -943,7 +938,7 @@ func (l *ReceiptsListener) isBlockFinal(blockNum *big.Int) bool {
943938
}
944939

945940
func (l *ReceiptsListener) latestBlockNum() *big.Int {
946-
// Cache latest block number for up to 3 seconds to avoid hammering monitor.LatestBlockNum()
941+
// Cache latest block number to avoid hammering monitor.LatestBlockNum()
947942
cachedTime := time.Unix(l.latestBlockNumTime.Load(), 0)
948943
if time.Since(cachedTime) < l.options.LatestBlockNumCacheTTL {
949944
cachedNum := l.latestBlockNumCache.Load()

ethreceipts/subscription.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func (s *subscriber) AddFilter(filterQueries ...FilterQuery) {
105105
// too many filters, ignore the extra filter. not ideal, but better than
106106
// deadlocking
107107
s.listener.log.Warn(fmt.Sprintf("ethreceipts: subscriber has too many filters (%d), ignoring extra", len(s.filters)+len(filters)))
108-
// TODO: maybe return an error instead?
108+
// TODO: maybe return an error or force-unsubscribe instead?
109109
s.mu.Unlock()
110110
return
111111
}

0 commit comments

Comments
 (0)