Tx audit tags handle coinbase
This commit is contained in:
parent
c17b77fe31
commit
7af185a919
@ -78,7 +78,8 @@
|
|||||||
{{ pool.name }}
|
{{ pool.name }}
|
||||||
</a>
|
</a>
|
||||||
<ng-container *ngIf="auditStatus">
|
<ng-container *ngIf="auditStatus">
|
||||||
<span *ngIf="auditStatus.expected; else seen" class="badge badge-success mr-1" i18n-ngbTooltip="Expected in block tooltip" ngbTooltip="This transaction was projected to be included in the block" placement="bottom" i18n="tx-features.tag.expected|Expected in Block">Expected in Block</span>
|
<span *ngIf="auditStatus.coinbase; else expected" class="badge badge-primary mr-1" i18n="tx-features.tag.coinbase|Coinbase">Coinbase</span>
|
||||||
|
<ng-template #expected><span *ngIf="auditStatus.expected; else seen" class="badge badge-success mr-1" i18n-ngbTooltip="Expected in block tooltip" ngbTooltip="This transaction was projected to be included in the block" placement="bottom" i18n="tx-features.tag.expected|Expected in Block">Expected in Block</span></ng-template>
|
||||||
<ng-template #seen><span *ngIf="auditStatus.seen; else notSeen" class="badge badge-success mr-1" i18n-ngbTooltip="Seen in mempool tooltip" ngbTooltip="This transaction was seen in the mempool prior to mining" placement="bottom" i18n="tx-features.tag.seen|Seen in Mempool">Seen in Mempool</span></ng-template>
|
<ng-template #seen><span *ngIf="auditStatus.seen; else notSeen" class="badge badge-success mr-1" i18n-ngbTooltip="Seen in mempool tooltip" ngbTooltip="This transaction was seen in the mempool prior to mining" placement="bottom" i18n="tx-features.tag.seen|Seen in Mempool">Seen in Mempool</span></ng-template>
|
||||||
<ng-template #notSeen><span class="badge badge-warning mr-1" i18n-ngbTooltip="Not seen in mempool tooltip" ngbTooltip="This transaction was missing from our mempool prior to mining" placement="bottom" i18n="tx-features.tag.not-seen|Not seen in Mempool">Not seen in Mempool</span></ng-template>
|
<ng-template #notSeen><span class="badge badge-warning mr-1" i18n-ngbTooltip="Not seen in mempool tooltip" ngbTooltip="This transaction was missing from our mempool prior to mining" placement="bottom" i18n="tx-features.tag.not-seen|Not seen in Mempool">Not seen in Mempool</span></ng-template>
|
||||||
<span *ngIf="auditStatus.added" class="badge badge-primary mr-1" i18n-ngbTooltip="Added transaction tooltip" ngbTooltip="This transaction may have been added or prioritized out-of-band" placement="bottom" i18n="tx-features.tag.added|Added">Added</span>
|
<span *ngIf="auditStatus.added" class="badge badge-primary mr-1" i18n-ngbTooltip="Added transaction tooltip" ngbTooltip="This transaction may have been added or prioritized out-of-band" placement="bottom" i18n="tx-features.tag.added|Added">Added</span>
|
||||||
|
@ -36,12 +36,13 @@ interface Pool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface AuditStatus {
|
interface AuditStatus {
|
||||||
seen: boolean;
|
seen?: boolean;
|
||||||
expected: boolean;
|
expected?: boolean;
|
||||||
added: boolean;
|
added?: boolean;
|
||||||
delayed?: number;
|
delayed?: number;
|
||||||
accelerated: boolean;
|
accelerated?: boolean;
|
||||||
conflict: boolean;
|
conflict?: boolean;
|
||||||
|
coinbase?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -296,6 +297,8 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
switchMap(({ hash, height, txid }) => {
|
switchMap(({ hash, height, txid }) => {
|
||||||
const foundBlock = this.cacheService.getCachedBlock(height) || null;
|
const foundBlock = this.cacheService.getCachedBlock(height) || null;
|
||||||
const auditAvailable = this.isAuditAvailable(height);
|
const auditAvailable = this.isAuditAvailable(height);
|
||||||
|
const isCoinbase = this.tx.vin.some(v => v.is_coinbase);
|
||||||
|
const fetchAudit = auditAvailable && !isCoinbase;
|
||||||
return combineLatest([
|
return combineLatest([
|
||||||
foundBlock ? of(foundBlock.extras.pool) : this.apiService.getBlock$(hash).pipe(
|
foundBlock ? of(foundBlock.extras.pool) : this.apiService.getBlock$(hash).pipe(
|
||||||
map(block => {
|
map(block => {
|
||||||
@ -305,7 +308,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
return of(null);
|
return of(null);
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
auditAvailable ? this.apiService.getBlockAudit$(hash).pipe(
|
fetchAudit ? this.apiService.getBlockAudit$(hash).pipe(
|
||||||
map(audit => {
|
map(audit => {
|
||||||
const isAdded = audit.addedTxs.includes(txid);
|
const isAdded = audit.addedTxs.includes(txid);
|
||||||
const isAccelerated = audit.acceleratedTxs.includes(txid);
|
const isAccelerated = audit.acceleratedTxs.includes(txid);
|
||||||
@ -322,7 +325,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
catchError(() => {
|
catchError(() => {
|
||||||
return of(null);
|
return of(null);
|
||||||
})
|
})
|
||||||
) : of(null)
|
) : of(isCoinbase ? { coinbase: true } : null)
|
||||||
]);
|
]);
|
||||||
}),
|
}),
|
||||||
catchError(() => {
|
catchError(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user