chainntfns/neutrinonotify: update driver to comply with BIP

This commit is contained in:
Alex 2017-10-11 13:27:38 -06:00 committed by Olaoluwa Osuntokun
parent 1c408adcab
commit 50d88e7769
1 changed files with 6 additions and 5 deletions

View File

@ -471,11 +471,12 @@ chainScan:
} }
blockHash := header.BlockHash() blockHash := header.BlockHash()
// With the hash computed, we can now fetch the extended filter // With the hash computed, we can now fetch the basic filter
// for this height. // for this height.
extFilter, err := n.p2pNode.GetCFilter(blockHash, true) regFilter, err := n.p2pNode.GetCFilter(blockHash,
wire.GCSFilterRegular)
if err != nil { if err != nil {
chainntnfs.Log.Errorf("unable to retrieve extended "+ chainntnfs.Log.Errorf("unable to retrieve regular "+
"filter for height=%v: %v", scanHeight, err) "filter for height=%v: %v", scanHeight, err)
return false return false
} }
@ -483,14 +484,14 @@ chainScan:
// If the block has no transactions other than the coinbase // If the block has no transactions other than the coinbase
// transaction, then the filter may be nil, so we'll continue // transaction, then the filter may be nil, so we'll continue
// forward int that case. // forward int that case.
if extFilter == nil { if regFilter == nil {
continue continue
} }
// In the case that the filter exists, we'll attempt to see if // In the case that the filter exists, we'll attempt to see if
// any element in it match our target txid. // any element in it match our target txid.
key := builder.DeriveKey(&blockHash) key := builder.DeriveKey(&blockHash)
match, err := extFilter.Match(key, targetHash[:]) match, err := regFilter.Match(key, targetHash[:])
if err != nil { if err != nil {
chainntnfs.Log.Errorf("unable to query filter: %v", err) chainntnfs.Log.Errorf("unable to query filter: %v", err)
return false return false