Commit 2545897
committed
fix(chain/local_v1): prevent double-close panic in block counter watcher
The count() loop could call close(watcher.channel) on consecutive ticks
before the WatchBlocks cleanup goroutine removed the cancelled watcher
from the list, causing a "close of closed channel" panic. Use sync.Once
to guarantee the channel is closed exactly once.1 parent cc30229 commit 2545897
1 file changed
+4
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
123 | | - | |
| 124 | + | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| |||
0 commit comments