Merge pull request #5177 from mempool/simon/deprecate-unique-pool-id
Deprecate pool_unique_id, fixing accelerations sync
This commit is contained in:
		
						commit
						d10fdaad46
					
				@ -31,10 +31,7 @@ export interface AccelerationHistory {
 | 
			
		||||
  feeDelta: number,
 | 
			
		||||
  blockHash: string,
 | 
			
		||||
  blockHeight: number,
 | 
			
		||||
  pools: {
 | 
			
		||||
    pool_unique_id: number,
 | 
			
		||||
    username: string,
 | 
			
		||||
  }[],
 | 
			
		||||
  pools: number[];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class AccelerationApi {
 | 
			
		||||
 | 
			
		||||
@ -308,10 +308,10 @@ class AccelerationRepository {
 | 
			
		||||
        }
 | 
			
		||||
        const accelerationSummaries = accelerations.map(acc => ({
 | 
			
		||||
          ...acc,
 | 
			
		||||
          pools: acc.pools.map(pool => pool.pool_unique_id),
 | 
			
		||||
          pools: acc.pools,
 | 
			
		||||
        }))
 | 
			
		||||
        for (const acc of accelerations) {
 | 
			
		||||
          if (blockTxs[acc.txid] && acc.pools.some(pool => pool.pool_unique_id === block.extras.pool.id)) {
 | 
			
		||||
          if (blockTxs[acc.txid] && acc.pools.includes(block.extras.pool.id)) {
 | 
			
		||||
            const tx = blockTxs[acc.txid];
 | 
			
		||||
            const accelerationInfo = accelerationCosts.getAccelerationInfo(tx, boostRate, transactions);
 | 
			
		||||
            accelerationInfo.cost = Math.max(0, Math.min(acc.feeDelta, accelerationInfo.cost));
 | 
			
		||||
 | 
			
		||||
@ -313,7 +313,7 @@ export class BlockComponent implements OnInit, OnDestroy {
 | 
			
		||||
 | 
			
		||||
      const acceleratedInBlock = {};
 | 
			
		||||
      for (const acc of accelerations) {
 | 
			
		||||
        if (acc.pools?.some(pool => pool === this.block?.extras?.pool.id || pool?.['pool_unique_id'] === this.block?.extras?.pool.id)) {
 | 
			
		||||
        if (acc.pools?.some(pool => pool === this.block?.extras?.pool.id)) {
 | 
			
		||||
          acceleratedInBlock[acc.txid] = acc;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
@ -665,7 +665,7 @@ export class TrackerComponent implements OnInit, OnDestroy {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  setIsAccelerated(initialState: boolean = false) {
 | 
			
		||||
    this.isAcceleration = (this.tx.acceleration || (this.accelerationInfo && this.pool && this.accelerationInfo.pools.some(pool => (pool === this.pool.id || pool?.['pool_unique_id'] === this.pool.id))));
 | 
			
		||||
    this.isAcceleration = (this.tx.acceleration || (this.accelerationInfo && this.pool && this.accelerationInfo.pools.some(pool => (pool === this.pool.id))));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  dismissAccelAlert(): void {
 | 
			
		||||
 | 
			
		||||
@ -726,7 +726,7 @@ export class TransactionComponent implements OnInit, AfterViewInit, OnDestroy {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  setIsAccelerated(initialState: boolean = false) {
 | 
			
		||||
    this.isAcceleration = (this.tx.acceleration || (this.accelerationInfo && this.pool && this.accelerationInfo.pools.some(pool => (pool === this.pool.id || pool?.['pool_unique_id'] === this.pool.id))));
 | 
			
		||||
    this.isAcceleration = (this.tx.acceleration || (this.accelerationInfo && this.pool && this.accelerationInfo.pools.some(pool => (pool === this.pool.id))));
 | 
			
		||||
    if (this.isAcceleration && initialState) {
 | 
			
		||||
      this.showAccelerationSummary = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -9126,11 +9126,7 @@ export const restApiDocsData = [
 | 
			
		||||
    "blockHash": "00000000000000000000482f0746d62141694b9210a813b97eb8445780a32003",
 | 
			
		||||
    "blockHeight": 829559,
 | 
			
		||||
    "bidBoost": 6102,
 | 
			
		||||
    "pools": [
 | 
			
		||||
      {
 | 
			
		||||
        "pool_unique_id": 111
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
    "pools": [111]
 | 
			
		||||
  }
 | 
			
		||||
]`,
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user