mirror of
https://github.com/mempool/mempool.git
synced 2025-10-04 18:43:24 +02:00
Update simplicity script to use the correct witness element
This commit is contained in:
@@ -342,10 +342,10 @@ export class TransactionsListComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
const isScriptSpend = vin.witness.length > (hasAnnex ? 2 : 1);
|
const isScriptSpend = vin.witness.length > (hasAnnex ? 2 : 1);
|
||||||
if (isScriptSpend) {
|
if (isScriptSpend) {
|
||||||
const controlBlock = hasAnnex ? vin.witness[vin.witness.length - 2] : vin.witness[vin.witness.length - 1];
|
const controlBlock = hasAnnex ? vin.witness[vin.witness.length - 2] : vin.witness[vin.witness.length - 1];
|
||||||
const scriptHex = hasAnnex ? vin.witness[vin.witness.length - 3] : vin.witness[vin.witness.length - 2];
|
|
||||||
const tapleafVersion = parseInt(controlBlock.slice(0, 2), 16) & 0xfe;
|
const tapleafVersion = parseInt(controlBlock.slice(0, 2), 16) & 0xfe;
|
||||||
// simplicity script spend
|
// simplicity script spend
|
||||||
if (tapleafVersion === 0xbe) {
|
if (tapleafVersion === 0xbe) {
|
||||||
|
const scriptHex = vin.witness[1]; // simplicity program is the second witness element
|
||||||
vin.inner_simplicityscript = scriptHex;
|
vin.inner_simplicityscript = scriptHex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -170,7 +170,7 @@ export class AddressTypeInfo {
|
|||||||
this.processScript(new ScriptInfo('inner_witnessscript', scriptHex, v.inner_witnessscript_asm, v.witness, controlBlock, vinIds?.[i]));
|
this.processScript(new ScriptInfo('inner_witnessscript', scriptHex, v.inner_witnessscript_asm, v.witness, controlBlock, vinIds?.[i]));
|
||||||
} else if (this.network === 'liquid' || this.network === 'liquidtestnet' && tapleafVersion === 0xbe) {
|
} else if (this.network === 'liquid' || this.network === 'liquidtestnet' && tapleafVersion === 0xbe) {
|
||||||
this.simplicity = true;
|
this.simplicity = true;
|
||||||
v.inner_simplicityscript = scriptHex;
|
v.inner_simplicityscript = v.witness[1];
|
||||||
this.processScript(new ScriptInfo('inner_simplicityscript', scriptHex, null, v.witness, controlBlock, vinIds?.[i]));
|
this.processScript(new ScriptInfo('inner_simplicityscript', scriptHex, null, v.witness, controlBlock, vinIds?.[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user