diff --git a/lib/messages/commands/block.js b/lib/messages/commands/block.js index 7eee962..6efc257 100644 --- a/lib/messages/commands/block.js +++ b/lib/messages/commands/block.js @@ -26,11 +26,11 @@ function BlockMessage(arg, options) { inherits(BlockMessage, Message); BlockMessage.prototype.setPayload = function(payload) { - this.block = this.Block.fromBuffer(payload); + this.block = this.Block.fromRaw(payload); }; BlockMessage.prototype.getPayload = function() { - return this.block.toBuffer(); + return this.block.toRaw(); }; module.exports = BlockMessage; diff --git a/lib/messages/commands/tx.js b/lib/messages/commands/tx.js index 1d4c46b..6d57999 100644 --- a/lib/messages/commands/tx.js +++ b/lib/messages/commands/tx.js @@ -28,15 +28,15 @@ function TransactionMessage(arg, options) { inherits(TransactionMessage, Message); TransactionMessage.prototype.setPayload = function(payload) { - if (this.Transaction.prototype.fromBuffer) { - this.transaction = new this.Transaction().fromBuffer(payload); + if (this.Transaction.prototype.fromRaw) { + this.transaction = new this.Transaction().fromRaw(payload); } else { - this.transaction = this.Transaction.fromBuffer(payload); + this.transaction = this.Transaction.fromRaw(payload); } }; TransactionMessage.prototype.getPayload = function() { - return this.transaction.toBuffer(); + return this.transaction.toRaw(); }; module.exports = TransactionMessage; diff --git a/lib/peer.js b/lib/peer.js index 01c0168..a8f4dc9 100644 --- a/lib/peer.js +++ b/lib/peer.js @@ -5,6 +5,7 @@ var EventEmitter = require('events').EventEmitter; var Net = require('net'); var Socks5Client = require('socks5-client'); var bitcore = require('bitcore-lib'); +var bcoin = require('bcoin'); var Networks = bitcore.Networks; var Messages = require('./messages'); var $ = bitcore.util.preconditions; @@ -65,8 +66,8 @@ function Peer(options) { this.messages = options.messages || new Messages({ network: this.network, - Block: bitcore.Block, - Transaction: bitcore.Transaction + Block: bcoin.block, + Transaction: bcoin.tx }); this.dataBuffer = new Buffers(); diff --git a/package.json b/package.json index 53e1ba0..1037f72 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,8 @@ "url": "https://github.com/bitpay/bitcore-p2p.git" }, "dependencies": { - "bitcore-lib": "^0.14", + "bitcore-lib": "bitpay/bitcore-lib#transitional", + "bcoin": "1.0.0-beta.12", "bloom-filter": "^0.2.0", "buffers": "bitpay/node-buffers#v0.1.2-bitpay", "socks5-client": "^0.3.6"