diff --git a/lib/messages/commands/tx.js b/lib/messages/commands/tx.js index 39898b1..7f622f9 100644 --- a/lib/messages/commands/tx.js +++ b/lib/messages/commands/tx.js @@ -3,7 +3,6 @@ var Message = require('../message'); var inherits = require('util').inherits; var bitcore = require('flocore-lib'); -var bcoin = require('fcoin'); var $ = bitcore.util.preconditions; var _ = bitcore.deps._; @@ -29,8 +28,8 @@ function TransactionMessage(arg, options) { inherits(TransactionMessage, Message); TransactionMessage.prototype.setPayload = function(payload) { - if (this.Transaction.prototype.fromRaw) { - this.transaction = bcoin.tx.fromRaw(payload); + if (typeof this.Transaction.fromRaw === 'function') { + this.transaction = this.Transaction.fromRaw(payload); } else if (this.Transaction.prototype.fromBuffer) { this.transaction = new this.Transaction().fromBuffer(payload); } else { @@ -39,7 +38,7 @@ TransactionMessage.prototype.setPayload = function(payload) { }; TransactionMessage.prototype.getPayload = function() { - if (this.Transaction.prototype.toRaw) { + if (typeof this.Transaction.fromRaw === 'function') { return this.transaction.toRaw(); } return this.transaction.toBuffer();