node/watchers/mock: add l1finalizer

This commit is contained in:
tbjump 2023-06-22 04:02:18 +00:00 committed by tbjump
parent 0d8bf5d3fe
commit e0cdf6d8d3
2 changed files with 7 additions and 1 deletions

View File

@ -20,6 +20,7 @@ type WatcherConfig struct {
ObservationDb ObservationDb // If the watcher receives a re-observation request with a TxHash in this map, it will make the corresponding observation in this map.
MockSetC <-chan *common.GuardianSet
L1FinalizerRequired watchers.NetworkID // (optional)
l1Finalizer interfaces.L1Finalizer
}
func (wc *WatcherConfig) GetNetworkID() watchers.NetworkID {
@ -35,7 +36,7 @@ func (wc *WatcherConfig) RequiredL1Finalizer() watchers.NetworkID {
}
func (wc *WatcherConfig) SetL1Finalizer(l1finalizer interfaces.L1Finalizer) {
// empty
wc.l1Finalizer = l1finalizer
}
func (wc *WatcherConfig) Create(

View File

@ -19,6 +19,11 @@ func NewWatcherRunnable(
return func(ctx context.Context) error {
logger := supervisor.Logger(ctx)
supervisor.Signal(ctx, supervisor.SignalHealthy)
if c.L1FinalizerRequired != "" && c.l1Finalizer == nil {
logger.Fatal("Mock watcher: L1FinalizerRequired but not set.")
}
logger.Info("Mock Watcher running.")
for {