From da4de1579d23bc3ea522db04ac4d5822f3f7e6bb Mon Sep 17 00:00:00 2001 From: yosoyubik Date: Sun, 8 May 2022 09:43:30 +0200 Subject: [PATCH] eth-watcher: discard future pend-logs in watchdog If there were pending-logs in an existing watchdog that was not fully restarted, and the number of the starting block is newer than the first in pending, when starting a new thread, those logs will be carried over to the new thread, which will then be re-downloaded and will fail to be verified in /lib/naive --- pkg/arvo/app/eth-watcher.hoon | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/arvo/app/eth-watcher.hoon b/pkg/arvo/app/eth-watcher.hoon index 5cb3340855..1e0fa21951 100644 --- a/pkg/arvo/app/eth-watcher.hoon +++ b/pkg/arvo/app/eth-watcher.hoon @@ -367,6 +367,17 @@ =/ dog=watchdog ?: restart *watchdog (~(got by dogs.state) path.poke) + =+ pending=(sort ~(tap in ~(key by pending-logs.dog)) lth) + =? pending-logs.dog + ?: restart | + ?~ pending | + (gte i.pending from.config.poke) + ?> ?=(^ pending) + :: if there are pending logs newer than what we poke with, + :: we need to clear those too avoid processing duplicates + :: + ~& %dropping-unreleased-logs^[from+i.pending n+(lent pending)] + ~ %_ dog - config.poke number from.config.poke