fix issue with mutable scripts.

This commit is contained in:
Christopher Jeffrey 2016-05-20 04:53:15 -07:00
parent f013ddb353
commit d4f03f982e
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
4 changed files with 6 additions and 5 deletions

View File

@ -32,7 +32,7 @@ var BufferWriter = require('./writer');
function Input(options, mutable) {
if (!(this instanceof Input))
return new Input(options);
return new Input(options, mutable);
assert(options, 'Input data is required.');

View File

@ -29,7 +29,7 @@ function Output(options, mutable) {
var value;
if (!(this instanceof Output))
return new Output(options);
return new Output(options, mutable);
assert(options, 'Output data is required.');
@ -43,7 +43,7 @@ function Output(options, mutable) {
this.script = bcoin.script(options.script, this.mutable);
assert(typeof this.value === 'number');
assert(!this.mutable || this.value > 0);
assert(!this.mutable || this.value >= 0);
}
/**

View File

@ -39,7 +39,7 @@ function Witness(items, mutable) {
}
if (!(this instanceof Witness))
return new Witness(items);
return new Witness(items, mutable);
this.mutable = !!mutable;
@ -818,7 +818,7 @@ function Script(code, mutable) {
}
if (!(this instanceof Script))
return new Script(code);
return new Script(code, mutable);
this.mutable = !!mutable;

View File

@ -40,6 +40,7 @@ describe('Chain', function() {
value: utils.satoshi('25.0')
});
redeemer.addInput(tx, 0);
redeemer.setLocktime(chain.height);
wallet.sign(redeemer);
attempt.addTX(redeemer);
}