bcoin tx and blocks support.
This commit is contained in:
parent
59fbc03715
commit
f537eb86b9
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user