FilterByBlockHash(), pointed out by davec@
This commit is contained in:
parent
9f02951b0e
commit
a77b1e00d5
3 changed files with 3 additions and 4 deletions
|
@ -163,8 +163,7 @@ func (idx *CBFIndex) DisconnectBlock(dbTx database.Tx, block *btcutil.Block,
|
||||||
return index.Delete(block.Hash()[:])
|
return index.Delete(block.Hash()[:])
|
||||||
}
|
}
|
||||||
|
|
||||||
func (idx *CBFIndex) GetFilterByBlockHash(hash *chainhash.Hash) ([]byte,
|
func (idx *CBFIndex) FilterByBlockHash(hash *chainhash.Hash) ([]byte, error) {
|
||||||
error) {
|
|
||||||
var filterBytes []byte
|
var filterBytes []byte
|
||||||
err := idx.db.View(func(dbTx database.Tx) error {
|
err := idx.db.View(func(dbTx database.Tx) error {
|
||||||
var err error
|
var err error
|
||||||
|
|
|
@ -2154,7 +2154,7 @@ func handleGetCBFilter(s *rpcServer, cmd interface{}, closeChan <-chan struct{})
|
||||||
return nil, rpcDecodeHexError(c.Hash)
|
return nil, rpcDecodeHexError(c.Hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
filterBytes, err := s.server.cbfIndex.GetFilterByBlockHash(hash)
|
filterBytes, err := s.server.cbfIndex.FilterByBlockHash(hash)
|
||||||
if len(filterBytes) > 0 {
|
if len(filterBytes) > 0 {
|
||||||
rpcsLog.Debugf("Found CB filter for %v", hash)
|
rpcsLog.Debugf("Found CB filter for %v", hash)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -746,7 +746,7 @@ func (sp *serverPeer) OnGetCBFilter(_ *peer.Peer, msg *wire.MsgGetCBFilter) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
filterBytes, err := sp.server.cbfIndex.GetFilterByBlockHash(&msg.BlockHash)
|
filterBytes, err := sp.server.cbfIndex.FilterByBlockHash(&msg.BlockHash)
|
||||||
|
|
||||||
if len(filterBytes) > 0 {
|
if len(filterBytes) > 0 {
|
||||||
peerLog.Infof("Obtained CB filter for %v", msg.BlockHash)
|
peerLog.Infof("Obtained CB filter for %v", msg.BlockHash)
|
||||||
|
|
Loading…
Add table
Reference in a new issue