Skip to content

Commit f1ef068

Browse files
authored
Merge pull request #1 from oipwg/update-fcoin
Update fcoin to 1.1.0
2 parents 25adf9f + c44229f commit f1ef068

File tree

5 files changed

+1618
-11047
lines changed

5 files changed

+1618
-11047
lines changed

lib/messages/builder.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
var bitcore = require('flocore-lib');
4+
var fcoin = require('fcoin');
45
var Inventory = require('../inventory');
56

67
function builder(options) {
@@ -15,9 +16,9 @@ function builder(options) {
1516
options.network = bitcore.Networks.defaultNetwork;
1617
}
1718

18-
options.Block = options.Block || bitcore.Block;
19+
options.Block = options.Block || fcoin.Block;
1920
options.BlockHeader = options.BlockHeader || bitcore.BlockHeader;
20-
options.Transaction = options.Transaction || bitcore.Transaction;
21+
options.Transaction = options.Transaction || fcoin.TX;
2122
options.MerkleBlock = options.MerkleBlock || bitcore.MerkleBlock;
2223
options.protocolVersion = options.protocolVersion || 70001;
2324

lib/messages/commands/block.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ function BlockMessage(arg, options) {
2626
inherits(BlockMessage, Message);
2727

2828
BlockMessage.prototype.setPayload = function(payload) {
29-
if (this.Block.prototype.fromRaw) {
29+
if (typeof this.Block.fromRaw === 'function') {
3030
this.block = this.Block.fromRaw(payload);
3131
} else {
3232
this.block = this.Block.fromBuffer(payload);
3333
}
3434
};
3535

3636
BlockMessage.prototype.getPayload = function() {
37-
if (this.Block.prototype.toRaw) {
37+
if (typeof this.Block.fromRaw === 'function') {
3838
return this.block.toRaw();
3939
}
4040
return this.block.toBuffer();

lib/messages/commands/tx.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
var Message = require('../message');
44
var inherits = require('util').inherits;
55
var bitcore = require('flocore-lib');
6-
var bcoin = require('fcoin');
76
var $ = bitcore.util.preconditions;
87
var _ = bitcore.deps._;
98

@@ -29,8 +28,8 @@ function TransactionMessage(arg, options) {
2928
inherits(TransactionMessage, Message);
3029

3130
TransactionMessage.prototype.setPayload = function(payload) {
32-
if (this.Transaction.prototype.fromRaw) {
33-
this.transaction = bcoin.tx.fromRaw(payload);
31+
if (typeof this.Transaction.fromRaw === 'function') {
32+
this.transaction = this.Transaction.fromRaw(payload);
3433
} else if (this.Transaction.prototype.fromBuffer) {
3534
this.transaction = new this.Transaction().fromBuffer(payload);
3635
} else {
@@ -39,7 +38,7 @@ TransactionMessage.prototype.setPayload = function(payload) {
3938
};
4039

4140
TransactionMessage.prototype.getPayload = function() {
42-
if (this.Transaction.prototype.toRaw) {
41+
if (typeof this.Transaction.fromRaw === 'function') {
4342
return this.transaction.toRaw();
4443
}
4544
return this.transaction.toBuffer();

0 commit comments

Comments
 (0)