Bitcore-p2p error parsing

Hi All,
Тhe second time I have asked for this problem, please tell me why the following error, when i use bitcore-p2p
throw new Error('Data still available after parsing'); ^ Error: Data still available after parsing at Object.checkFinished (/root/RiskEngine1/node_modules/bitcore-p2p/lib/messages/utils.js:20:13)

Can you describe more precisely when this happend? Or rather what message was parsed when this happend?

thanks for answer.
for exampel when I use following code

`var timeStamp = require(’./utils/timeStamp’);
var bitcore = require(‘bitcore-lib’);
var p2p = require(‘bitcore-p2p’);
var BufferUtil = bitcore.util.buffer;
var Networks = bitcore.Networks;
var Messages = p2p.Messages;
var messages = new Messages();

var Pool = p2p.Pool;
var pool = new Pool({
network: Networks.livenet,
addrs: [
ip: {
v4: ‘’

pool.on(‘peerinv’, function (peer, message) {
message.inventory.forEach(function (inv) {
var reversed = BufferUtil.reverse(inv.hash);
var hexaInv = BufferUtil.bufferToHex(reversed);
} catch (ex){

// Address
peer.on('ready', function () {
    var getAddrMessage = messages.GetAddr();

peer.on('addr', function (message) {
    message.addresses.forEach(function (address) {



for short period script works print this error
throw new Error('Data still available after parsing'); ^ Error: Data still available after parsing at Object.checkFinished (/root/RiskEngine1/node_modules/bitcore-p2p/lib/messages/utils.js:20:13)

Unfortunately, I cannot fully understand the intention of your snippet. However, two things which come to my mind immediately:

  1. You add the listener for the peers ready event inside the inv listener, at that point the ready event was already triggered, as the peer is already connected.
  2. The inv event is triggered very often, if you add a listener each time, this causes a memory leak and the max size of listeners will be reached very soon.

If I understand you correctly, the manual adding of addresses is not necessary. Inside the pool.connect() call the bootstrapping via dns seeds is happening and ips are retrieved already…

Maybe I can help you, if you describe the intention of code more precisely.

I need get all INV message that coming my node, and will need save to DB.
but Perhaps ‘‘Short period’’ after the script needs to be written correctly for them to understand me clear, printed that error

Ok, I get the same error now. The error is thrown when parsing an incoming addr message. The error might be related to this issue: the version of the p2p-protocol is < 31402 (

However, I am not sure if there is still such an old bitcoin node running, this error might be caused by something else…