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);
|
return new Witness(options);
|
||||||
|
|
||||||
this.items = [];
|
this.items = [];
|
||||||
this.redeem = null;
|
|
||||||
|
|
||||||
if (options)
|
if (options)
|
||||||
this.fromOptions(options);
|
this.fromOptions(options);
|
||||||
@ -247,18 +246,12 @@ Witness.prototype.test = function test(filter) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Witness.prototype.getRedeem = function getRedeem() {
|
Witness.prototype.getRedeem = function getRedeem() {
|
||||||
var redeem;
|
var redeem = this.items[this.items.length - 1];
|
||||||
|
|
||||||
if (!this.redeem) {
|
if (!redeem)
|
||||||
redeem = this.items[this.items.length - 1];
|
return;
|
||||||
|
|
||||||
if (!redeem)
|
return new Script(redeem);
|
||||||
return;
|
|
||||||
|
|
||||||
this.redeem = new Script(redeem);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.redeem;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1105,7 +1098,6 @@ function Script(options) {
|
|||||||
|
|
||||||
this.raw = STACK_FALSE;
|
this.raw = STACK_FALSE;
|
||||||
this.code = [];
|
this.code = [];
|
||||||
this.redeem = null;
|
|
||||||
|
|
||||||
if (options)
|
if (options)
|
||||||
this.fromOptions(options);
|
this.fromOptions(options);
|
||||||
@ -2602,19 +2594,15 @@ Script.createCommitment = function createCommitment(hash, flags) {
|
|||||||
Script.prototype.getRedeem = function getRedeem() {
|
Script.prototype.getRedeem = function getRedeem() {
|
||||||
var redeem;
|
var redeem;
|
||||||
|
|
||||||
if (!this.redeem) {
|
if (!this.isPushOnly())
|
||||||
if (!this.isPushOnly())
|
return;
|
||||||
return;
|
|
||||||
|
|
||||||
redeem = this.code[this.code.length - 1];
|
redeem = this.code[this.code.length - 1];
|
||||||
|
|
||||||
if (!redeem || !redeem.data)
|
if (!redeem || !redeem.data)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.redeem = new Script(redeem.data);
|
return new Script(redeem.data);
|
||||||
}
|
|
||||||
|
|
||||||
return this.redeem;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user