I’m trying this code:

var Pool = require('bitcore-p2p').Pool;
var BloomFilter = require('bitcore-p2p').BloomFilter;
var Networks = require('bitcore-lib').Networks;
var Messages = require('bitcore-p2p').Messages;

var pool = new Pool({network: Networks.livenet});

var code = new Buffer('1CjPR7Z5ZSyWk6WtXvSFgkptmpoi4UM9BC','base64');
var filter = BloomFilter.create(1, 0.1);

var messages = new Messages();
var lessRecent = messages.GetData.forBlock('000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e');
var messageFilter = messages.FilterLoad(filter);

pool.on('peerblock', function(peer, message) {
last = message;

then I call:


LessRecent is a request for a block that is supposed to be blocked by the filter, but seems that the peers disregard my request for load the filter.

You may need to use peermerkleblock instead. You should also notice a decrease in the number of tx inv messages once the filter is loaded.

Ok, thanks.

I have changed getData.forBlock() with getData.forFilteredBlock() and I listen for peermerkleblock.

Now it seem that work.
When I have the merkleBlock how can I do for check if the merkleBlock contain a tx that match my filter?

There is a hasTransaction method on merkleBlock: