Use new class based function checking instead of prototypal checking
This commit is contained in:
parent
d1034b3a82
commit
e334370777
@ -3,7 +3,6 @@
|
|||||||
var Message = require('../message');
|
var Message = require('../message');
|
||||||
var inherits = require('util').inherits;
|
var inherits = require('util').inherits;
|
||||||
var bitcore = require('flocore-lib');
|
var bitcore = require('flocore-lib');
|
||||||
var bcoin = require('fcoin');
|
|
||||||
var $ = bitcore.util.preconditions;
|
var $ = bitcore.util.preconditions;
|
||||||
var _ = bitcore.deps._;
|
var _ = bitcore.deps._;
|
||||||
|
|
||||||
@ -29,8 +28,8 @@ function TransactionMessage(arg, options) {
|
|||||||
inherits(TransactionMessage, Message);
|
inherits(TransactionMessage, Message);
|
||||||
|
|
||||||
TransactionMessage.prototype.setPayload = function(payload) {
|
TransactionMessage.prototype.setPayload = function(payload) {
|
||||||
if (this.Transaction.prototype.fromRaw) {
|
if (typeof this.Transaction.fromRaw === 'function') {
|
||||||
this.transaction = bcoin.tx.fromRaw(payload);
|
this.transaction = this.Transaction.fromRaw(payload);
|
||||||
} else if (this.Transaction.prototype.fromBuffer) {
|
} else if (this.Transaction.prototype.fromBuffer) {
|
||||||
this.transaction = new this.Transaction().fromBuffer(payload);
|
this.transaction = new this.Transaction().fromBuffer(payload);
|
||||||
} else {
|
} else {
|
||||||
@ -39,7 +38,7 @@ TransactionMessage.prototype.setPayload = function(payload) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TransactionMessage.prototype.getPayload = function() {
|
TransactionMessage.prototype.getPayload = function() {
|
||||||
if (this.Transaction.prototype.toRaw) {
|
if (typeof this.Transaction.fromRaw === 'function') {
|
||||||
return this.transaction.toRaw();
|
return this.transaction.toRaw();
|
||||||
}
|
}
|
||||||
return this.transaction.toBuffer();
|
return this.transaction.toBuffer();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user