Unblinding refactor fix

This commit is contained in:
softsimon 2021-08-18 03:34:17 +03:00
parent fe1d153632
commit e20100e437
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7
2 changed files with 11 additions and 8 deletions

View File

@ -68,7 +68,7 @@ export class LiquidUnblinding {
tx._unblinded = { matched, total: this.commitments.size };
this.deduceBlinded(tx);
if (matched < this.commitments.size) {
throw new Error(`Error: Invalid blinding data.`)
throw new Error(`Invalid blinding data.`)
}
tx._deduced = false; // invalidate cache so deduction is attempted again
return tx._unblinded;

View File

@ -156,10 +156,19 @@ export class TransactionComponent implements OnInit, OnDestroy {
);
})
)
.subscribe((tx: Transaction) => {
.subscribe(async (tx: Transaction) => {
if (!tx) {
return;
}
if (this.network === 'liquid') {
try {
await this.liquidUnblinding.checkUnblindedTx(tx)
} catch (error) {
this.errorUnblinded = error;
}
}
this.tx = tx;
if (tx.fee === undefined) {
this.tx.fee = 0;
@ -197,12 +206,6 @@ export class TransactionComponent implements OnInit, OnDestroy {
this.fetchCpfp$.next(this.tx.txid);
}
}
if (this.network === 'liquid') {
this.liquidUnblinding.checkUnblindedTx(this.tx)
.catch((error) => {
this.errorUnblinded = error;
});
}
},
(error) => {
this.error = error;