fix checkMerge, and tests
This commit is contained in:
parent
494fc25d27
commit
8660120add
|
@ -866,8 +866,13 @@ TransactionBuilder.fromObj = function(data) {
|
|||
|
||||
|
||||
TransactionBuilder.prototype._checkMergeability = function(b) {
|
||||
if (JSON.stringify(this.vanilla) !== JSON.stringify(this.vanilla))
|
||||
throw new Error('cannot merge: incompatible builders')
|
||||
|
||||
var toCompare = ['opts', 'hashToScriptMap', 'outs', 'uxtos'];
|
||||
for (var i in toCompare) {
|
||||
var k = toCompare[i];
|
||||
if (JSON.stringify(this.vanilla[k]) !== JSON.stringify(b.vanilla[k]))
|
||||
throw new Error('cannot merge: incompatible builders:' + k)
|
||||
}
|
||||
};
|
||||
|
||||
// TODO this could be on Script class
|
||||
|
|
|
@ -1030,7 +1030,7 @@ describe('TransactionBuilder', function() {
|
|||
}]);
|
||||
(function() {
|
||||
b2.merge(b);
|
||||
}).should.throw('NTXID');
|
||||
}).should.throw('incompatible');
|
||||
});
|
||||
it('should check addresses', function() {
|
||||
// bad out
|
||||
|
@ -1040,7 +1040,7 @@ describe('TransactionBuilder', function() {
|
|||
}]);
|
||||
(function() {
|
||||
b2.merge(b);
|
||||
}).should.throw('NTXID');
|
||||
}).should.throw('incompatible');
|
||||
});
|
||||
|
||||
|
||||
|
@ -1060,7 +1060,7 @@ describe('TransactionBuilder', function() {
|
|||
|
||||
(function() {
|
||||
b2.merge(b);
|
||||
}).should.throw('signhash');
|
||||
}).should.throw('incompatible');
|
||||
});
|
||||
|
||||
|
||||
|
@ -1202,7 +1202,7 @@ describe('TransactionBuilder', function() {
|
|||
b2.sign(k2);
|
||||
(function() {
|
||||
b2.merge(b)
|
||||
}).should.throw('NTXID');
|
||||
}).should.throw('incompatible');
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue