From f537eb86b9759985822f0f35887642040b1165cb Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Fri, 21 Jul 2017 09:05:56 -0400 Subject: [PATCH 1/3] bcoin tx and blocks support. --- lib/messages/commands/block.js | 4 ++-- lib/messages/commands/tx.js | 8 ++++---- lib/peer.js | 5 +++-- package.json | 1 + 4 files changed, 10 insertions(+), 8 deletions(-) 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..29a780c 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ }, "dependencies": { "bitcore-lib": "^0.14", + "bcoin": "bcoin-org/bcoin#master", "bloom-filter": "^0.2.0", "buffers": "bitpay/node-buffers#v0.1.2-bitpay", "socks5-client": "^0.3.6" From 2fd4cbf622c56cb39c66e6b63424b87e475af044 Mon Sep 17 00:00:00 2001 From: Gabe Gattis Date: Fri, 21 Jul 2017 12:50:04 -0400 Subject: [PATCH 2/3] change bcoin dependency to 1.0.0-beta.12 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 29a780c..9075065 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ }, "dependencies": { "bitcore-lib": "^0.14", - "bcoin": "bcoin-org/bcoin#master", + "bcoin": "1.0.0-beta.12", "bloom-filter": "^0.2.0", "buffers": "bitpay/node-buffers#v0.1.2-bitpay", "socks5-client": "^0.3.6" From d7970b2553b2a09a0eb0fd735f00e8fc6d0a704d Mon Sep 17 00:00:00 2001 From: Jason Dreyzehner Date: Tue, 15 Aug 2017 16:12:43 -0400 Subject: [PATCH 3/3] chore(package): use transitional bitcore-lib --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9075065..1037f72 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "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",