Add % difference to weight and tx count in audit details
This commit is contained in:
parent
5b62966863
commit
bfb842d7ea
@ -428,12 +428,18 @@
|
||||
<td i18n="block.actual-weight">Actual weight</td>
|
||||
<td [innerHTML]>
|
||||
<span [innerHTML]="'‎' + (block.weight | wuBytes: 2)"></span>
|
||||
<span *ngIf="blockAudit.weightDelta" class="difference" [class.positive]="blockAudit.weightDelta <= 0" [class.negative]="blockAudit.weightDelta > 0">
|
||||
{{ blockAudit.weightDelta < 0 ? '+' : '' }}{{ (-blockAudit.weightDelta * 100) | amountShortener: 2 }}%
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td i18n="block.actual_transaction_count">Actual transactions</td>
|
||||
<td>
|
||||
{{ block.tx_count }}
|
||||
<span *ngIf="blockAudit.txDelta" class="difference" [class.positive]="blockAudit.txDelta <= 0" [class.negative]="blockAudit.txDelta > 0">
|
||||
{{ blockAudit.txDelta < 0 ? '+' : '' }}{{ (-blockAudit.txDelta * 100) | amountShortener: 2 }}%
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -388,7 +388,11 @@ export class BlockComponent implements OnInit, OnDestroy {
|
||||
for (const tx of blockAudit.transactions) {
|
||||
inBlock[tx.txid] = true;
|
||||
}
|
||||
blockAudit.feeDelta = (blockAudit.expectedFees - this.block.extras.totalFees) / blockAudit.expectedFees;
|
||||
|
||||
blockAudit.feeDelta = blockAudit.expectedFees > 0 ? (blockAudit.expectedFees - this.block.extras.totalFees) / blockAudit.expectedFees : 0;
|
||||
blockAudit.weightDelta = blockAudit.expectedWeight > 0 ? (blockAudit.expectedWeight - this.block.weight) / blockAudit.expectedWeight : 0;
|
||||
blockAudit.txDelta = blockAudit.template.length > 0 ? (blockAudit.template.length - this.block.tx_count) / blockAudit.template.length : 0;
|
||||
|
||||
this.setAuditAvailable(true);
|
||||
} else {
|
||||
this.setAuditAvailable(false);
|
||||
|
@ -153,6 +153,8 @@ export interface BlockAudit extends BlockExtended {
|
||||
expectedFees: number,
|
||||
expectedWeight: number,
|
||||
feeDelta?: number,
|
||||
weightDelta?: number,
|
||||
txDelta?: number,
|
||||
template: TransactionStripped[],
|
||||
transactions: TransactionStripped[],
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user