Display sigops on all transactions

This commit is contained in:
Mononaut 2023-09-19 00:18:52 +00:00
parent a510b4992c
commit 4ac0a6dad2
No known key found for this signature in database
GPG key ID: A3F058E41374C04E
3 changed files with 17 additions and 4 deletions

View file

@ -292,9 +292,9 @@
<td i18n="transaction.vsize|Transaction Virtual Size">Virtual size</td> <td i18n="transaction.vsize|Transaction Virtual Size">Virtual size</td>
<td [innerHTML]="'&lrm;' + (tx.weight / 4 | vbytes: 2)"></td> <td [innerHTML]="'&lrm;' + (tx.weight / 4 | vbytes: 2)"></td>
</tr> </tr>
<tr *ngIf="cpfpInfo && cpfpInfo.adjustedVsize && cpfpInfo.adjustedVsize > (tx.weight / 4)"> <tr *ngIf="adjustedVsize != null">
<td i18n="transaction.adjusted-vsize|Transaction Adjusted VSize">Adjusted vsize</td> <td i18n="transaction.adjusted-vsize|Transaction Adjusted VSize">Adjusted vsize</td>
<td [innerHTML]="'&lrm;' + (cpfpInfo.adjustedVsize | vbytes: 2)"></td> <td [innerHTML]="'&lrm;' + (adjustedVsize | vbytes: 2)"></td>
</tr> </tr>
<tr> <tr>
<td i18n="block.weight">Weight</td> <td i18n="block.weight">Weight</td>
@ -314,9 +314,9 @@
<td i18n="transaction.locktime">Locktime</td> <td i18n="transaction.locktime">Locktime</td>
<td [innerHTML]="'&lrm;' + (tx.locktime | number)"></td> <td [innerHTML]="'&lrm;' + (tx.locktime | number)"></td>
</tr> </tr>
<tr *ngIf="cpfpInfo && cpfpInfo.adjustedVsize && cpfpInfo.adjustedVsize > (tx.weight / 4)"> <tr *ngIf="sigops != null">
<td i18n="transaction.sigops|Transaction Sigops">Sigops</td> <td i18n="transaction.sigops|Transaction Sigops">Sigops</td>
<td [innerHTML]="'&lrm;' + (cpfpInfo.sigops | number)"></td> <td [innerHTML]="'&lrm;' + (sigops | number)"></td>
</tr> </tr>
<tr> <tr>
<td i18n="transaction.hex">Transaction hex</td> <td i18n="transaction.hex">Transaction hex</td>

View file

@ -62,6 +62,8 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
rbfReplaces: string[]; rbfReplaces: string[];
rbfInfo: RbfTree; rbfInfo: RbfTree;
cpfpInfo: CpfpInfo | null; cpfpInfo: CpfpInfo | null;
sigops: number | null;
adjustedVsize: number | null;
showCpfpDetails = false; showCpfpDetails = false;
fetchCpfp$ = new Subject<string>(); fetchCpfp$ = new Subject<string>();
fetchRbfHistory$ = new Subject<string>(); fetchRbfHistory$ = new Subject<string>();
@ -343,6 +345,10 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
if (tx.fee === undefined) { if (tx.fee === undefined) {
this.tx.fee = 0; this.tx.fee = 0;
} }
if (this.tx.sigops != null) {
this.sigops = this.tx.sigops;
this.adjustedVsize = Math.max(this.tx.weight / 4, this.sigops * 5);
}
this.tx.feePerVsize = tx.fee / (tx.weight / 4); this.tx.feePerVsize = tx.fee / (tx.weight / 4);
this.isLoadingTx = false; this.isLoadingTx = false;
this.error = undefined; this.error = undefined;
@ -543,6 +549,10 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
} }
this.cpfpInfo = cpfpInfo; this.cpfpInfo = cpfpInfo;
if (this.cpfpInfo.adjustedVsize && this.cpfpInfo.sigops != null) {
this.sigops = this.cpfpInfo.sigops;
this.adjustedVsize = this.cpfpInfo.adjustedVsize;
}
this.hasEffectiveFeeRate = hasRelatives || (this.tx.effectiveFeePerVsize && (Math.abs(this.tx.effectiveFeePerVsize - this.tx.feePerVsize) > 0.01)); this.hasEffectiveFeeRate = hasRelatives || (this.tx.effectiveFeePerVsize && (Math.abs(this.tx.effectiveFeePerVsize - this.tx.feePerVsize) > 0.01));
} }
@ -569,6 +579,8 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
this.replaced = false; this.replaced = false;
this.transactionTime = -1; this.transactionTime = -1;
this.cpfpInfo = null; this.cpfpInfo = null;
this.adjustedVsize = null;
this.sigops = null;
this.hasEffectiveFeeRate = false; this.hasEffectiveFeeRate = false;
this.rbfInfo = null; this.rbfInfo = null;
this.rbfReplaces = []; this.rbfReplaces = [];

View file

@ -26,6 +26,7 @@ export interface Transaction {
_outspends?: Outspend[]; _outspends?: Outspend[];
_channels?: TransactionChannels; _channels?: TransactionChannels;
price?: Price; price?: Price;
sigops?: number;
} }
export interface TransactionChannels { export interface TransactionChannels {