From ac580b34278a438f8ed9fcbdfa9b68373e8aba45 Mon Sep 17 00:00:00 2001 From: cuiweixie Date: Fri, 8 Aug 2025 20:38:04 +0800 Subject: [PATCH] accounts: simplify code with new api(SubscribeFilterLogs) --- accounts/abi/bind/v2/base.go | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/accounts/abi/bind/v2/base.go b/accounts/abi/bind/v2/base.go index 535c0ed4fd..9956257541 100644 --- a/accounts/abi/bind/v2/base.go +++ b/accounts/abi/bind/v2/base.go @@ -473,23 +473,11 @@ func (c *BoundContract) FilterLogs(opts *FilterOpts, name string, query ...[]any if opts.End != nil { config.ToBlock = new(big.Int).SetUint64(*opts.End) } - /* TODO(karalabe): Replace the rest of the method below with this when supported + sub, err := c.filterer.SubscribeFilterLogs(ensureContext(opts.Context), config, logs) - */ - buff, err := c.filterer.FilterLogs(ensureContext(opts.Context), config) if err != nil { return nil, nil, err } - sub := event.NewSubscription(func(quit <-chan struct{}) error { - for _, log := range buff { - select { - case logs <- log: - case <-quit: - return nil - } - } - return nil - }) return logs, sub, nil }