We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, I can't get transaction's information. In this code, the tx event is never emitted. Connected, ready and inv events are emitted but not tx.
var bitcore = require('bitcore-p2p'); var Peer = bitcore.Peer; var peer = new Peer({host: '127.0.0.1', port: 8333}); peer.on('disconnect', function () { console.log('connection closed'); }); peer.on('connect', function () { console.log('connected'); }); peer.on('inv', function (msg) { console.log('inv'); }); peer.on('ready', function() { console.log('ready'); }); peer.on('tx', function(message) { // message.transaction console.log(message); }); peer.connect();
In this file: https://github.com/bitpay/bitcore-p2p/blob/master/lib/peer.js#L218 I have edited the _readMessage function to debug it:
Peer.prototype._readMessage = function() { var message = this.messages.parseBuffer(this.dataBuffer); if(message == undefined) console.log(message); else console.log(message.command); if (message) { this.emit(message.command, message); this._readMessage(); } };
output:
inv undefined inv undefined inv undefined
The text was updated successfully, but these errors were encountered:
the tx message is only sent by the peer, if a getdata request is made. See the bitcoin wiki: https://en.bitcoin.it/wiki/Protocol_documentation#inv
so after you received the inv message, you need to create an getdata response and only then you'll get the tx or block messages...
Sorry, something went wrong.
Related: #82
Thank you for your answer, I'll try it.
No branches or pull requests
Hi,
I can't get transaction's information. In this code, the tx event is never emitted. Connected, ready and inv events are emitted but not tx.
In this file:
https://github.com/bitpay/bitcore-p2p/blob/master/lib/peer.js#L218
I have edited the _readMessage function to debug it:
output:
The text was updated successfully, but these errors were encountered: