better identification of lightning outputs. (#320)
* better identification of lightning outputs. * identify liquid pegouts and emergency pegouts. fixes #324
This commit is contained in:
parent
448cb8e264
commit
276117fba9
@ -1,2 +1,18 @@
|
|||||||
<span *ngIf="multisig" class="badge badge-pill badge-warning" i18n="address-labels.multisig">multisig {{ multisigM }} of {{ multisigN }}</span>
|
<span
|
||||||
<span *ngIf="secondLayerClose" class="badge badge-pill badge-warning" i18n="address-labels.upper-layer-peg-out">Layer{{ network === 'liquid' ? '3' : '2' }} Peg-out</span>
|
*ngIf="multisig"
|
||||||
|
class="badge badge-pill badge-warning"
|
||||||
|
i18n="address-labels.multisig"
|
||||||
|
>multisig {{ multisigM }} of {{ multisigN }}</span
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
*ngIf="lightning"
|
||||||
|
class="badge badge-pill badge-warning"
|
||||||
|
i18n="address-labels.upper-layer-peg-out"
|
||||||
|
>Lightning {{ lightning }}</span
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
*ngIf="liquid"
|
||||||
|
class="badge badge-pill badge-warning"
|
||||||
|
i18n="address-labels.upper-layer-peg-out"
|
||||||
|
>Liquid {{ liquid }}</span
|
||||||
|
>
|
||||||
|
@ -18,7 +18,8 @@ export class AddressLabelsComponent implements OnInit {
|
|||||||
multisigM: number;
|
multisigM: number;
|
||||||
multisigN: number;
|
multisigN: number;
|
||||||
|
|
||||||
secondLayerClose = false;
|
lightning = null;
|
||||||
|
liquid = null;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
stateService: StateService,
|
stateService: StateService,
|
||||||
@ -36,6 +37,26 @@ export class AddressLabelsComponent implements OnInit {
|
|||||||
|
|
||||||
handleVin() {
|
handleVin() {
|
||||||
if (this.vin.inner_witnessscript_asm) {
|
if (this.vin.inner_witnessscript_asm) {
|
||||||
|
if (this.vin.inner_witnessscript_asm.indexOf('OP_DEPTH OP_PUSHNUM_12 OP_EQUAL OP_IF OP_PUSHNUM_11') === 0) {
|
||||||
|
if (this.vin.witness.length > 11) {
|
||||||
|
this.liquid = 'Peg Out';
|
||||||
|
} else {
|
||||||
|
this.liquid = 'Emergency Peg Out';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[
|
||||||
|
[/^OP_DUP OP_HASH160/, 'HTLC'],
|
||||||
|
[/^OP_IF OP_PUSHBYTES_33 \w{33} OP_ELSE OP_PUSHBYTES_2 \w{2} OP_CSV OP_DROP/, 'Force Close']
|
||||||
|
].forEach(
|
||||||
|
([re, label]) => {
|
||||||
|
if (re.test(this.vin.inner_witnessscript_asm)) {
|
||||||
|
this.lightning = label;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (this.vin.inner_witnessscript_asm.indexOf('OP_CHECKMULTISIG') > -1) {
|
if (this.vin.inner_witnessscript_asm.indexOf('OP_CHECKMULTISIG') > -1) {
|
||||||
const matches = this.getMatches(this.vin.inner_witnessscript_asm, /OP_PUSHNUM_([0-9])/g, 1);
|
const matches = this.getMatches(this.vin.inner_witnessscript_asm, /OP_PUSHNUM_([0-9])/g, 1);
|
||||||
this.multisig = true;
|
this.multisig = true;
|
||||||
@ -46,10 +67,6 @@ export class AddressLabelsComponent implements OnInit {
|
|||||||
this.multisig = false;
|
this.multisig = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/OP_IF (.+) OP_ELSE (.+) OP_CSV OP_DROP/.test(this.vin.inner_witnessscript_asm)) {
|
|
||||||
this.secondLayerClose = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.vin.inner_redeemscript_asm && this.vin.inner_redeemscript_asm.indexOf('OP_CHECKMULTISIG') > -1) {
|
if (this.vin.inner_redeemscript_asm && this.vin.inner_redeemscript_asm.indexOf('OP_CHECKMULTISIG') > -1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user