do not cache redeem script.
This commit is contained in:
parent
3e0830fe8e
commit
27b88ddba9
@ -39,7 +39,6 @@ function Witness(options) {
|
||||
return new Witness(options);
|
||||
|
||||
this.items = [];
|
||||
this.redeem = null;
|
||||
|
||||
if (options)
|
||||
this.fromOptions(options);
|
||||
@ -247,18 +246,12 @@ Witness.prototype.test = function test(filter) {
|
||||
*/
|
||||
|
||||
Witness.prototype.getRedeem = function getRedeem() {
|
||||
var redeem;
|
||||
var redeem = this.items[this.items.length - 1];
|
||||
|
||||
if (!this.redeem) {
|
||||
redeem = this.items[this.items.length - 1];
|
||||
if (!redeem)
|
||||
return;
|
||||
|
||||
if (!redeem)
|
||||
return;
|
||||
|
||||
this.redeem = new Script(redeem);
|
||||
}
|
||||
|
||||
return this.redeem;
|
||||
return new Script(redeem);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1105,7 +1098,6 @@ function Script(options) {
|
||||
|
||||
this.raw = STACK_FALSE;
|
||||
this.code = [];
|
||||
this.redeem = null;
|
||||
|
||||
if (options)
|
||||
this.fromOptions(options);
|
||||
@ -2602,19 +2594,15 @@ Script.createCommitment = function createCommitment(hash, flags) {
|
||||
Script.prototype.getRedeem = function getRedeem() {
|
||||
var redeem;
|
||||
|
||||
if (!this.redeem) {
|
||||
if (!this.isPushOnly())
|
||||
return;
|
||||
if (!this.isPushOnly())
|
||||
return;
|
||||
|
||||
redeem = this.code[this.code.length - 1];
|
||||
redeem = this.code[this.code.length - 1];
|
||||
|
||||
if (!redeem || !redeem.data)
|
||||
return;
|
||||
if (!redeem || !redeem.data)
|
||||
return;
|
||||
|
||||
this.redeem = new Script(redeem.data);
|
||||
}
|
||||
|
||||
return this.redeem;
|
||||
return new Script(redeem.data);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user