Merge pull request #4768 from mempool/nymkappa/provisional-status
[accelerator] add provisional status
This commit is contained in:
		
						commit
						0b173296c4
					
				@ -205,7 +205,7 @@ class AccelerationRepository {
 | 
			
		||||
          break;
 | 
			
		||||
        }
 | 
			
		||||
        for (const acc of accelerations) {
 | 
			
		||||
          if (acc.status !== 'mined' && acc.status !== 'completed') {
 | 
			
		||||
          if (acc.status !== 'completed_provisional' && acc.status !== 'completed') {
 | 
			
		||||
            continue;
 | 
			
		||||
          }
 | 
			
		||||
          if (!lastSyncedHeight || acc.blockHeight > lastSyncedHeight) {
 | 
			
		||||
 | 
			
		||||
@ -50,9 +50,8 @@
 | 
			
		||||
            </td>
 | 
			
		||||
            <td class="status text-right">
 | 
			
		||||
              <span *ngIf="acceleration.status === 'accelerating'" class="badge badge-warning" i18n="accelerator.pending">Pending</span>
 | 
			
		||||
              <span *ngIf="acceleration.status === 'mined'" class="badge badge-info" i18n="transaction.rbf.mined">Mined</span>
 | 
			
		||||
              <span *ngIf="acceleration.status === 'completed'" class="badge badge-success" i18n="">Completed</span>
 | 
			
		||||
              <span *ngIf="acceleration.status === 'failed'" class="badge badge-danger" i18n="accelerator.canceled">Canceled</span>
 | 
			
		||||
              <span *ngIf="acceleration.status.includes('completed')" class="badge badge-success" i18n="">Completed <span *ngIf="acceleration.status === 'completed_provisional'">🔄</span></span>
 | 
			
		||||
              <span *ngIf="acceleration.status.includes('failed')" class="badge badge-danger" i18n="accelerator.canceled">Failed <span *ngIf="acceleration.status === 'failed_provisional'">🔄</span></span>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td class="date text-right" *ngIf="!this.widget">
 | 
			
		||||
              <app-time kind="since" [time]="acceleration.added" [fastRender]="true"></app-time>
 | 
			
		||||
 | 
			
		||||
@ -74,7 +74,7 @@ export class AcceleratorDashboardComponent implements OnInit {
 | 
			
		||||
 | 
			
		||||
    this.minedAccelerations$ = this.accelerations$.pipe(
 | 
			
		||||
      map(accelerations => {
 | 
			
		||||
        return accelerations.filter(acc => ['mined', 'completed'].includes(acc.status));
 | 
			
		||||
        return accelerations.filter(acc => ['completed_provisional', 'completed'].includes(acc.status));
 | 
			
		||||
      })
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
@ -103,7 +103,7 @@ export class AcceleratorDashboardComponent implements OnInit {
 | 
			
		||||
        }
 | 
			
		||||
        const accelerationsByBlock: { [ hash: string ]: Acceleration[] } = {};
 | 
			
		||||
        for (const acceleration of accelerations) {
 | 
			
		||||
          if (['mined', 'completed'].includes(acceleration.status) && acceleration.pools.includes(blockMap[acceleration.blockHash]?.extras.pool.id)) {
 | 
			
		||||
          if (['completed_provisional', 'failed_provisional', 'completed'].includes(acceleration.status) && acceleration.pools.includes(blockMap[acceleration.blockHash]?.extras.pool.id)) {
 | 
			
		||||
            if (!accelerationsByBlock[acceleration.blockHash]) {
 | 
			
		||||
              accelerationsByBlock[acceleration.blockHash] = [];
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -281,7 +281,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
 | 
			
		||||
      })
 | 
			
		||||
    ).subscribe((accelerationHistory) => {
 | 
			
		||||
      for (const acceleration of accelerationHistory) {
 | 
			
		||||
        if (acceleration.txid === this.txId && (acceleration.status === 'completed' || acceleration.status === 'mined') && acceleration.feePaid > 0) {
 | 
			
		||||
        if (acceleration.txid === this.txId && (acceleration.status === 'completed' || acceleration.status === 'completed_provisional')) {
 | 
			
		||||
          acceleration.acceleratedFee = Math.max(acceleration.effectiveFee, acceleration.effectiveFee + acceleration.feePaid - acceleration.baseFee - acceleration.vsizeFee);
 | 
			
		||||
          this.accelerationInfo = acceleration;
 | 
			
		||||
        }
 | 
			
		||||
@ -520,7 +520,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
 | 
			
		||||
          block_time: block.timestamp,
 | 
			
		||||
        };
 | 
			
		||||
        this.stateService.markBlock$.next({ blockHeight: block.height });
 | 
			
		||||
        if (this.tx.acceleration || (this.accelerationInfo && ['accelerating', 'mined', 'completed'].includes(this.accelerationInfo.status))) {
 | 
			
		||||
        if (this.tx.acceleration || (this.accelerationInfo && ['accelerating', 'completed_provisional', 'completed'].includes(this.accelerationInfo.status))) {
 | 
			
		||||
          this.audioService.playSound('wind-chimes-harp-ascend');
 | 
			
		||||
        } else {
 | 
			
		||||
          this.audioService.playSound('magic');
 | 
			
		||||
 | 
			
		||||
@ -378,7 +378,7 @@ export interface INode {
 | 
			
		||||
 | 
			
		||||
export interface Acceleration {
 | 
			
		||||
  txid: string;
 | 
			
		||||
  status: 'requested' | 'accelerating' | 'mined' | 'completed' | 'failed';
 | 
			
		||||
  status: 'requested' | 'accelerating' | 'completed_provisional' | 'completed' | 'failed' | 'failed_provisional';
 | 
			
		||||
  pools: number[];
 | 
			
		||||
  feePaid: number;
 | 
			
		||||
  added: number; // timestamp
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user