From 2f644d9b62d4d50acbc1c2bbceeb2b434faf6331 Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Wed, 15 Aug 2018 14:51:31 -0700 Subject: [PATCH] chainntnfs/neutrinonotify: disable disconnected block ntfns while rescanning In this commit, we modify the rescan options Neutrino uses when performing a rescan for historical chain events to disable disconnected block notifications. This is needed as the Neutrino backend will mutate its internal state while rewinding, which causes disconnected block notifications to be sent. Since the notifier acts upon these notifications, they would cause it to also rewind unnecessarily. --- chainntnfs/neutrinonotify/neutrino.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chainntnfs/neutrinonotify/neutrino.go b/chainntnfs/neutrinonotify/neutrino.go index c7cf321e..5fb4d2a3 100644 --- a/chainntnfs/neutrinonotify/neutrino.go +++ b/chainntnfs/neutrinonotify/neutrino.go @@ -373,6 +373,7 @@ out: rescanUpdate := []neutrino.UpdateOption{ neutrino.AddAddrs(addrs...), neutrino.Rewind(currentHeight), + neutrino.DisableDisconnectedNtfns(true), } err = n.chainView.Update(rescanUpdate...) if err != nil { @@ -870,6 +871,7 @@ func (n *NeutrinoNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint, rescanUpdate := []neutrino.UpdateOption{ neutrino.AddInputs(inputToWatch), neutrino.Rewind(currentHeight), + neutrino.DisableDisconnectedNtfns(true), } if err := n.chainView.Update(rescanUpdate...); err != nil {