P2P not getting INV message

(Susanna Hayrapetyan) #1

Hi,
we’re using your bitcore-p2p module, to get INV messages.

Our p2p pool is getting INV messages fine, but after some time stops getting them without any error.
We have tried to save connection of our pool and bitcoin network using ping and pong messages, but it haven’t take any effect.

Here is code example:

var pool = new Pool({
    network: Networks.livenet,
    maxSize: 150,
    dnsSeed: false,
    addrs: hosts
});


pool.connect();

pool.on('peerinv', function (peer, message) {

                   var Invs = message.inventory;
                    async.eachLimit(Invs, 20, function (inv, cb) {
                        var invHash = lib.util.buffer.bufferToHex(lib.util.buffer.reverse(inv.hash));
                        //console.log(invHash);
                        cb();
                    }, function (err) {
                        assert.equal(null, err); 
                    })

                    peer.sendMessage(messages.Ping());
                    peer.on('ping', function (message) {
                        console.log(message.nonce);
                        peer._sendPong(message.nonce);
                    });

                    peer.on('ready', function() {
                        console.log("ready",pool.inspect());
                        peer.sendMessage(messages.GetAddresses());
                    });

                    peer.on('addr', function(message) {
                        message.addresses.forEach(function(addr) {
                            console.log(addr);
                            pool._connectPeer(addr);
                            console.log(pool.inspect());
                        });
                    });
})
0 Likes

(Susanna Hayrapetyan) #2

Hi sorry the issue was MongoDb related and has been resolved.

1 Like