Merge remote-tracking branch 'upstream/bcoin'

This commit is contained in:
Jason Dreyzehner 2017-08-18 18:51:34 -04:00
commit 0e333f3248
4 changed files with 11 additions and 9 deletions

View File

@ -26,11 +26,11 @@ function BlockMessage(arg, options) {
inherits(BlockMessage, Message); inherits(BlockMessage, Message);
BlockMessage.prototype.setPayload = function(payload) { BlockMessage.prototype.setPayload = function(payload) {
this.block = this.Block.fromBuffer(payload); this.block = this.Block.fromRaw(payload);
}; };
BlockMessage.prototype.getPayload = function() { BlockMessage.prototype.getPayload = function() {
return this.block.toBuffer(); return this.block.toRaw();
}; };
module.exports = BlockMessage; module.exports = BlockMessage;

View File

@ -28,15 +28,15 @@ function TransactionMessage(arg, options) {
inherits(TransactionMessage, Message); inherits(TransactionMessage, Message);
TransactionMessage.prototype.setPayload = function(payload) { TransactionMessage.prototype.setPayload = function(payload) {
if (this.Transaction.prototype.fromBuffer) { if (this.Transaction.prototype.fromRaw) {
this.transaction = new this.Transaction().fromBuffer(payload); this.transaction = new this.Transaction().fromRaw(payload);
} else { } else {
this.transaction = this.Transaction.fromBuffer(payload); this.transaction = this.Transaction.fromRaw(payload);
} }
}; };
TransactionMessage.prototype.getPayload = function() { TransactionMessage.prototype.getPayload = function() {
return this.transaction.toBuffer(); return this.transaction.toRaw();
}; };
module.exports = TransactionMessage; module.exports = TransactionMessage;

View File

@ -5,6 +5,7 @@ var EventEmitter = require('events').EventEmitter;
var Net = require('net'); var Net = require('net');
var Socks5Client = require('socks5-client'); var Socks5Client = require('socks5-client');
var bitcore = require('bitcore-lib'); var bitcore = require('bitcore-lib');
var bcoin = require('bcoin');
var Networks = bitcore.Networks; var Networks = bitcore.Networks;
var Messages = require('./messages'); var Messages = require('./messages');
var $ = bitcore.util.preconditions; var $ = bitcore.util.preconditions;
@ -65,8 +66,8 @@ function Peer(options) {
this.messages = options.messages || new Messages({ this.messages = options.messages || new Messages({
network: this.network, network: this.network,
Block: bitcore.Block, Block: bcoin.block,
Transaction: bitcore.Transaction Transaction: bcoin.tx
}); });
this.dataBuffer = new Buffers(); this.dataBuffer = new Buffers();

View File

@ -56,7 +56,8 @@
"url": "https://github.com/bitpay/bitcore-p2p.git" "url": "https://github.com/bitpay/bitcore-p2p.git"
}, },
"dependencies": { "dependencies": {
"bitcore-lib": "^0.14", "bitcore-lib": "bitpay/bitcore-lib#transitional",
"bcoin": "1.0.0-beta.12",
"bloom-filter": "^0.2.0", "bloom-filter": "^0.2.0",
"buffers": "bitpay/node-buffers#v0.1.2-bitpay", "buffers": "bitpay/node-buffers#v0.1.2-bitpay",
"socks5-client": "^0.3.6" "socks5-client": "^0.3.6"