mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
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:
parent
610a93e2ff
commit
753f30a6ff
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user