tx: refactor hasStandardWitness.
This commit is contained in:
parent
063f55f448
commit
57b98b2368
@ -1629,14 +1629,14 @@ TX.prototype.hasStandardWitness = function hasStandardWitness(view) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const redeem = witness.items[witness.items.length - 1];
|
||||
const raw = witness.items[witness.items.length - 1];
|
||||
|
||||
if (redeem.length > policy.MAX_P2WSH_SIZE)
|
||||
if (raw.length > policy.MAX_P2WSH_SIZE)
|
||||
return false;
|
||||
|
||||
prev = new Script(redeem);
|
||||
const redeem = Script.fromRaw(raw);
|
||||
|
||||
if (prev.isPubkey()) {
|
||||
if (redeem.isPubkey()) {
|
||||
if (witness.items.length - 1 !== 1)
|
||||
return false;
|
||||
|
||||
@ -1646,7 +1646,7 @@ TX.prototype.hasStandardWitness = function hasStandardWitness(view) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (prev.isPubkeyhash()) {
|
||||
if (redeem.isPubkeyhash()) {
|
||||
if (input.witness.items.length - 1 !== 2)
|
||||
return false;
|
||||
|
||||
@ -1659,7 +1659,7 @@ TX.prototype.hasStandardWitness = function hasStandardWitness(view) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const [m] = prev.getMultisig();
|
||||
const [m] = redeem.getMultisig();
|
||||
|
||||
if (m !== -1) {
|
||||
if (witness.items.length - 1 !== m + 1)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user