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.
This commit is contained in:
Wilmer Paulino 2018-08-15 14:51:31 -07:00
parent 96a079873a
commit 2f644d9b62
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

@ -373,6 +373,7 @@ out:
rescanUpdate := []neutrino.UpdateOption{ rescanUpdate := []neutrino.UpdateOption{
neutrino.AddAddrs(addrs...), neutrino.AddAddrs(addrs...),
neutrino.Rewind(currentHeight), neutrino.Rewind(currentHeight),
neutrino.DisableDisconnectedNtfns(true),
} }
err = n.chainView.Update(rescanUpdate...) err = n.chainView.Update(rescanUpdate...)
if err != nil { if err != nil {
@ -870,6 +871,7 @@ func (n *NeutrinoNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint,
rescanUpdate := []neutrino.UpdateOption{ rescanUpdate := []neutrino.UpdateOption{
neutrino.AddInputs(inputToWatch), neutrino.AddInputs(inputToWatch),
neutrino.Rewind(currentHeight), neutrino.Rewind(currentHeight),
neutrino.DisableDisconnectedNtfns(true),
} }
if err := n.chainView.Update(rescanUpdate...); err != nil { if err := n.chainView.Update(rescanUpdate...); err != nil {