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.
This commit is contained in:
Johan T. Halseth 2019-10-15 11:25:31 +02:00
parent 610a93e2ff
commit 753f30a6ff
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

View File

@ -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)