From 753f30a6fffe1092409eb142c0624922013fcf8d Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Tue, 15 Oct 2019 11:25:31 +0200 Subject: [PATCH] chainntnfs/neutrino: don't ignore failed filter fetches Earlier GetCFilter could return a nil-error along with a nil-filter in cases where we failed to fetch the filter. We would just ignore the block causing us to miss potential crucial information. Now that GetCFilter will return an error in cases where the fetch failed, the filter will never be nil (even for blocks with only coinbase transactions), and we'll instead return an error. We also increase the number of retries for the filter from the default 2 to 5. --- chainntnfs/neutrinonotify/neutrino.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/chainntnfs/neutrinonotify/neutrino.go b/chainntnfs/neutrinonotify/neutrino.go index 410e6789d..dfe6fca3a 100644 --- a/chainntnfs/neutrinonotify/neutrino.go +++ b/chainntnfs/neutrinonotify/neutrino.go @@ -527,19 +527,13 @@ func (n *NeutrinoNotifier) historicalConfDetails(confRequest chainntnfs.ConfRequ // for this height. regFilter, err := n.p2pNode.GetCFilter( *blockHash, wire.GCSFilterRegular, + neutrino.NumRetries(5), ) if err != nil { return nil, fmt.Errorf("unable to retrieve regular filter for "+ "height=%v: %v", scanHeight, err) } - // If the block has no transactions other than the Coinbase - // transaction, then the filter may be nil, so we'll continue - // forward int that case. - if regFilter == nil { - continue - } - // In the case that the filter exists, we'll attempt to see if // any element in it matches our target public key script. key := builder.DeriveKey(blockHash)