e2e accelerations
This commit is contained in:
		
							parent
							
								
									05e88a25be
								
							
						
					
					
						commit
						79fce5a269
					
				@ -594,4 +594,63 @@ describe('Mainnet', () => {
 | 
			
		||||
  } else {
 | 
			
		||||
    it.skip(`Tests cannot be run on the selected BASE_MODULE ${baseModule}`);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  describe('Accelerated Transactions', () => {
 | 
			
		||||
    describe('Unconfirmed Accelerated Transaction', () => {
 | 
			
		||||
      before(() => {
 | 
			
		||||
        cy.intercept('/api/tx/40ba6b3c4ce73e3ba0160c137b1cc6c2c7333a2b9c19537b61ee8a8aaf095e0a', {
 | 
			
		||||
          fixture: 'accelerated_tx.json'
 | 
			
		||||
        }).as('tx');
 | 
			
		||||
 | 
			
		||||
        cy.intercept('/api/v1/cpfp/40ba6b3c4ce73e3ba0160c137b1cc6c2c7333a2b9c19537b61ee8a8aaf095e0a', {
 | 
			
		||||
          fixture: 'accelerated_cpfp.json'
 | 
			
		||||
        }).as('accelerated_cpfp');
 | 
			
		||||
 | 
			
		||||
        cy.intercept('/api/v1/transaction-times?txId%5B%5D=40ba6b3c4ce73e3ba0160c137b1cc6c2c7333a2b9c19537b61ee8a8aaf095e0a', {
 | 
			
		||||
          body: '[1723416086]',
 | 
			
		||||
        }).as('transaction-time');
 | 
			
		||||
 | 
			
		||||
        cy.intercept('https://mempool.space/api/v1/services/accelerator/accelerations/history', {
 | 
			
		||||
          fixture: 'accelerated_history.json'
 | 
			
		||||
        }).as('history');
 | 
			
		||||
 | 
			
		||||
        cy.viewport('macbook-16');
 | 
			
		||||
        cy.mockMempoolSocket();
 | 
			
		||||
        cy.visit('/tx/40ba6b3c4ce73e3ba0160c137b1cc6c2c7333a2b9c19537b61ee8a8aaf095e0a');
 | 
			
		||||
 | 
			
		||||
        emitMempoolInfo({
 | 
			
		||||
          'params': {
 | 
			
		||||
            command: 'txPosition'
 | 
			
		||||
          }
 | 
			
		||||
        });
 | 
			
		||||
        cy.waitForSkeletonGone();
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      it('shows unconfirmed accelerated transaction properly', () => {
 | 
			
		||||
        cy.get('.badge-accelerated').should('exist');
 | 
			
		||||
        cy.get('[data-cy="active-acceleration-box"]').should('exist');
 | 
			
		||||
        cy.get('[data-cy="active-acceleration-box"] > table > tbody > :nth-child(1) .oobFees').invoke('text').should('contain', `15.5 `);
 | 
			
		||||
        cy.get('[data-cy="tx-fee-delta"]').invoke('text').should('contain', `3,000`);
 | 
			
		||||
        cy.get('#acceleration-timeline').should('be.visible');
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      // currently doesn't work due to 'accelerations/history' endpoint not being intercepted
 | 
			
		||||
      it.skip('properly render accelerated transacion as it confirms', () => {
 | 
			
		||||
        emitMempoolInfo({
 | 
			
		||||
          'params': {
 | 
			
		||||
            command: 'txPositionConfirmed'
 | 
			
		||||
          }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        cy.wait(1000);
 | 
			
		||||
 | 
			
		||||
        cy.get('.badge-accelerated').should('exist');
 | 
			
		||||
        cy.get('[data-cy="active-acceleration-box"]').should('not.exist');
 | 
			
		||||
        cy.get('[data-cy="fee-rate"]').invoke('text').should('contain', `2.17 `);
 | 
			
		||||
        cy.get('[data-cy="tx-fee-delta"]').invoke('text').should('contain', `39`);
 | 
			
		||||
        cy.get('#acceleration-timeline').should('be.visible');
 | 
			
		||||
      });
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										20
									
								
								frontend/cypress/fixtures/accelerated_cpfp.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								frontend/cypress/fixtures/accelerated_cpfp.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
			
		||||
{
 | 
			
		||||
  "ancestors": [],
 | 
			
		||||
  "bestDescendant": null,
 | 
			
		||||
  "descendants": [],
 | 
			
		||||
  "effectiveFeePerVsize": 15.452914798206278,
 | 
			
		||||
  "sigops": 4,
 | 
			
		||||
  "fee": 446,
 | 
			
		||||
  "adjustedVsize": 223,
 | 
			
		||||
  "acceleration": true,
 | 
			
		||||
  "acceleratedBy": [
 | 
			
		||||
      111,
 | 
			
		||||
      43,
 | 
			
		||||
      102,
 | 
			
		||||
      112,
 | 
			
		||||
      142,
 | 
			
		||||
      115
 | 
			
		||||
  ],
 | 
			
		||||
  "acceleratedAt": 1723417553,
 | 
			
		||||
  "feeDelta": 3000
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										24
									
								
								frontend/cypress/fixtures/accelerated_history.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								frontend/cypress/fixtures/accelerated_history.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,24 @@
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
      "txid": "40ba6b3c4ce73e3ba0160c137b1cc6c2c7333a2b9c19537b61ee8a8aaf095e0a",
 | 
			
		||||
      "status": "completed",
 | 
			
		||||
      "added": 1723417553,
 | 
			
		||||
      "lastUpdated": 1723424127,
 | 
			
		||||
      "effectiveFee": 446,
 | 
			
		||||
      "effectiveVsize": 223,
 | 
			
		||||
      "feeDelta": 3000,
 | 
			
		||||
      "blockHash": "000000000000000000005bc0a822da172e43c687428cc268177ad27d636f3059",
 | 
			
		||||
      "blockHeight": 856387,
 | 
			
		||||
      "bidBoost": 39,
 | 
			
		||||
      "boostVersion": "v2",
 | 
			
		||||
      "pools": [
 | 
			
		||||
          111,
 | 
			
		||||
          43,
 | 
			
		||||
          102,
 | 
			
		||||
          112,
 | 
			
		||||
          142,
 | 
			
		||||
          115
 | 
			
		||||
      ],
 | 
			
		||||
      "minedByPoolUniqueId": 111
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
							
								
								
									
										48
									
								
								frontend/cypress/fixtures/accelerated_position.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								frontend/cypress/fixtures/accelerated_position.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,48 @@
 | 
			
		||||
{
 | 
			
		||||
  "txPosition": {
 | 
			
		||||
      "txid": "40ba6b3c4ce73e3ba0160c137b1cc6c2c7333a2b9c19537b61ee8a8aaf095e0a",
 | 
			
		||||
      "position": {
 | 
			
		||||
          "block": 0,
 | 
			
		||||
          "vsize": 37321.5,
 | 
			
		||||
          "accelerated": true
 | 
			
		||||
      },
 | 
			
		||||
      "accelerationPositions": [
 | 
			
		||||
          {
 | 
			
		||||
              "block": 0,
 | 
			
		||||
              "vsize": 37321.5,
 | 
			
		||||
              "poolId": 111,
 | 
			
		||||
              "pool": "Foundry USA"
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
              "block": 0,
 | 
			
		||||
              "vsize": 37321.5,
 | 
			
		||||
              "poolId": 43,
 | 
			
		||||
              "pool": "Braiins Pool"
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
              "block": 0,
 | 
			
		||||
              "vsize": 37321.5,
 | 
			
		||||
              "poolId": 102,
 | 
			
		||||
              "pool": "SpiderPool"
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
              "block": 0,
 | 
			
		||||
              "vsize": 37321.5,
 | 
			
		||||
              "poolId": 112,
 | 
			
		||||
              "pool": "SBI Crypto"
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
              "block": 0,
 | 
			
		||||
              "vsize": 37321.5,
 | 
			
		||||
              "poolId": 142,
 | 
			
		||||
              "pool": "OCEAN"
 | 
			
		||||
          },
 | 
			
		||||
          {
 | 
			
		||||
              "block": 0,
 | 
			
		||||
              "vsize": 37321.5,
 | 
			
		||||
              "poolId": 115,
 | 
			
		||||
              "pool": "MARA Pool"
 | 
			
		||||
          }
 | 
			
		||||
      ]
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,66 @@
 | 
			
		||||
{
 | 
			
		||||
  "txConfirmed": "40ba6b3c4ce73e3ba0160c137b1cc6c2c7333a2b9c19537b61ee8a8aaf095e0a",
 | 
			
		||||
  "block":{
 | 
			
		||||
    "id": "000000000000000000014cc3d86b7c096ef92aca180e3cf27d72e34ce944caed",
 | 
			
		||||
    "height": 837051,
 | 
			
		||||
    "version": 821051392,
 | 
			
		||||
    "timestamp": 1723452588,
 | 
			
		||||
    "bits": 386079422,
 | 
			
		||||
    "nonce": 2215159619,
 | 
			
		||||
    "difficulty": 90666502495565.78,
 | 
			
		||||
    "merkle_root": "207ad51f6c1150f63fcd043eb1b4624b77ac70558594317e989c1109fbb47c47",
 | 
			
		||||
    "tx_count": 2284,
 | 
			
		||||
    "size": 1490522,
 | 
			
		||||
    "weight": 3993155,
 | 
			
		||||
    "previousblockhash": "00000000000000000002b8a66307c997aa27bf99a384ceb7cfe5f29576eddb26",
 | 
			
		||||
    "mediantime": 1723450608,
 | 
			
		||||
    "stale": false,
 | 
			
		||||
    "extras": {
 | 
			
		||||
      "reward": 319417632,
 | 
			
		||||
      "coinbaseRaw": "0378110d04adccb9662f466f756e6472792055534120506f6f6c202364726f70676f6c642f2c08727fca05000000000000",
 | 
			
		||||
      "orphans": [],
 | 
			
		||||
      "medianFee": 4.021446911342697,
 | 
			
		||||
      "feeRange": [
 | 
			
		||||
        3.1,
 | 
			
		||||
        3.4184397163120566,
 | 
			
		||||
        3.998624011007912,
 | 
			
		||||
        4.444976076555024,
 | 
			
		||||
        5.382978723404255,
 | 
			
		||||
        11.62814371257485,
 | 
			
		||||
        468.75
 | 
			
		||||
      ],
 | 
			
		||||
      "totalFees": 6917632,
 | 
			
		||||
      "avgFee": 3030,
 | 
			
		||||
      "avgFeeRate": 6,
 | 
			
		||||
      "utxoSetChange": -2647,
 | 
			
		||||
      "avgTxSize": 652.44,
 | 
			
		||||
      "totalInputs": 8544,
 | 
			
		||||
      "totalOutputs": 5897,
 | 
			
		||||
      "totalOutputAmt": 2950130527407,
 | 
			
		||||
      "segwitTotalTxs": 2084,
 | 
			
		||||
      "segwitTotalSize": 1137877,
 | 
			
		||||
      "segwitTotalWeight": 2582683,
 | 
			
		||||
      "feePercentiles": null,
 | 
			
		||||
      "virtualSize": 998288.75,
 | 
			
		||||
      "coinbaseAddress": "bc1p8k4v4xuz55dv49svzjg43qjxq2whur7ync9tm0xgl5t4wjl9ca9snxgmlt",
 | 
			
		||||
      "coinbaseAddresses": [
 | 
			
		||||
        "bc1p8k4v4xuz55dv49svzjg43qjxq2whur7ync9tm0xgl5t4wjl9ca9snxgmlt",
 | 
			
		||||
        "bc1qxhmdufsvnuaaaer4ynz88fspdsxq2h9e9cetdj"
 | 
			
		||||
      ],
 | 
			
		||||
      "coinbaseSignature": "OP_PUSHNUM_1 OP_PUSHBYTES_32 3daaca9b82a51aca960c1491588246029d7e0fc49e0abdbcc8fd17574be5c74b",
 | 
			
		||||
      "coinbaseSignatureAscii": "f/Foundry USA Pool #dropgold/",
 | 
			
		||||
      "header": "0040f03026dbed7695f2e5cfb7ce84a399bf27aa97c90763a6b802000000000000000000477cb4fb09119c987e3194855570ac774b62b4b13e04cd3ff650116c1fd57a20acccb966be1a031743a70884",
 | 
			
		||||
      "utxoSetSize": null,
 | 
			
		||||
      "totalInputAmt": null,
 | 
			
		||||
      "pool": {
 | 
			
		||||
        "id": 111,
 | 
			
		||||
        "name": "Foundry USA",
 | 
			
		||||
        "slug": "foundryusa"
 | 
			
		||||
      },
 | 
			
		||||
      "matchRate": 100,
 | 
			
		||||
      "expectedFees": 6957093,
 | 
			
		||||
      "expectedWeight": 3991895,
 | 
			
		||||
      "similarity": 0.9907343565880212
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										45
									
								
								frontend/cypress/fixtures/accelerated_tx.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								frontend/cypress/fixtures/accelerated_tx.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,45 @@
 | 
			
		||||
{
 | 
			
		||||
  "txid": "40ba6b3c4ce73e3ba0160c137b1cc6c2c7333a2b9c19537b61ee8a8aaf095e0a",
 | 
			
		||||
  "version": 1,
 | 
			
		||||
  "locktime": 0,
 | 
			
		||||
  "vin": [
 | 
			
		||||
      {
 | 
			
		||||
          "txid": "7c6e17739d7225d097db1f08df17d06dc712dc0951f266db1070939b85b5e8e7",
 | 
			
		||||
          "vout": 0,
 | 
			
		||||
          "prevout": {
 | 
			
		||||
              "scriptpubkey": "76a914fb706ea28ba8f83e3cfa2fa1f3f01a6a613b94ca88ac",
 | 
			
		||||
              "scriptpubkey_asm": "OP_DUP OP_HASH160 OP_PUSHBYTES_20 fb706ea28ba8f83e3cfa2fa1f3f01a6a613b94ca OP_EQUALVERIFY OP_CHECKSIG",
 | 
			
		||||
              "scriptpubkey_type": "p2pkh",
 | 
			
		||||
              "scriptpubkey_address": "1PvVJ5FvkNnsatmD4nfkb6j59CjKq7dxxy",
 | 
			
		||||
              "value": 16610556
 | 
			
		||||
          },
 | 
			
		||||
          "scriptsig": "483045022100811726483f9c91dd91aa136c6ba4e97e6db79ef7026aa4fdd4216ea6a954f91a0220508b7fdf4078bf82114f7cfed5090b77114dec19b122870a34e562689441399d01210275f84bf0270b233f83be9b1ba6549e3281a133bfd93b24e1c16d80c4e742f09e",
 | 
			
		||||
          "scriptsig_asm": "OP_PUSHBYTES_72 3045022100811726483f9c91dd91aa136c6ba4e97e6db79ef7026aa4fdd4216ea6a954f91a0220508b7fdf4078bf82114f7cfed5090b77114dec19b122870a34e562689441399d01 OP_PUSHBYTES_33 0275f84bf0270b233f83be9b1ba6549e3281a133bfd93b24e1c16d80c4e742f09e",
 | 
			
		||||
          "is_coinbase": false,
 | 
			
		||||
          "sequence": 4294967295
 | 
			
		||||
      }
 | 
			
		||||
  ],
 | 
			
		||||
  "vout": [
 | 
			
		||||
      {
 | 
			
		||||
          "scriptpubkey": "0014ce6c0bb00482016d12657174b6468cd01df6421e",
 | 
			
		||||
          "scriptpubkey_asm": "OP_0 OP_PUSHBYTES_20 ce6c0bb00482016d12657174b6468cd01df6421e",
 | 
			
		||||
          "scriptpubkey_type": "v0_p2wpkh",
 | 
			
		||||
          "scriptpubkey_address": "bc1qeekqhvqysgqk6yn9w96tv35v6qwlvss7vuvtj0",
 | 
			
		||||
          "value": 6796193
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
          "scriptpubkey": "76a914fb706ea28ba8f83e3cfa2fa1f3f01a6a613b94ca88ac",
 | 
			
		||||
          "scriptpubkey_asm": "OP_DUP OP_HASH160 OP_PUSHBYTES_20 fb706ea28ba8f83e3cfa2fa1f3f01a6a613b94ca OP_EQUALVERIFY OP_CHECKSIG",
 | 
			
		||||
          "scriptpubkey_type": "p2pkh",
 | 
			
		||||
          "scriptpubkey_address": "1PvVJ5FvkNnsatmD4nfkb6j59CjKq7dxxy",
 | 
			
		||||
          "value": 9813917
 | 
			
		||||
      }
 | 
			
		||||
  ],
 | 
			
		||||
  "size": 223,
 | 
			
		||||
  "weight": 892,
 | 
			
		||||
  "sigops": 4,
 | 
			
		||||
  "fee": 446,
 | 
			
		||||
  "status": {
 | 
			
		||||
      "confirmed": false
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -96,6 +96,18 @@ export const emitMempoolInfo = ({
 | 
			
		||||
				});
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
			case 'txPosition': {
 | 
			
		||||
				cy.readFile('cypress/fixtures/accelerated_position.json', 'ascii').then((fixture) => {
 | 
			
		||||
					win.mockSocket.send(JSON.stringify(fixture));
 | 
			
		||||
				});
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
			case 'txPositionConfirmed': {
 | 
			
		||||
				cy.readFile('cypress/fixtures/accelerated_position_confirmed.json', 'ascii').then((fixture) => {
 | 
			
		||||
					win.mockSocket.send(JSON.stringify(fixture));
 | 
			
		||||
				});
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
			default:
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -608,7 +608,7 @@
 | 
			
		||||
      <td class="td-width" i18n="transaction.fee|Transaction fee">Fee</td>
 | 
			
		||||
      <td class="text-wrap">{{ tx.fee | number }} <span class="symbol" i18n="shared.sats">sats</span>
 | 
			
		||||
        @if (accelerationInfo?.bidBoost ?? tx.feeDelta > 0) {
 | 
			
		||||
          <span class="oobFees" i18n-ngbTooltip="Acceleration Fees" ngbTooltip="Acceleration fees paid out-of-band"> +{{ accelerationInfo?.bidBoost ?? tx.feeDelta | number }} </span><span class="symbol" i18n="shared.sats">sats</span>
 | 
			
		||||
          <span class="oobFees" [attr.data-cy]="'tx-fee-delta'" i18n-ngbTooltip="Acceleration Fees" ngbTooltip="Acceleration fees paid out-of-band"> +{{ accelerationInfo?.bidBoost ?? tx.feeDelta | number }} </span><span class="symbol" i18n="shared.sats">sats</span>
 | 
			
		||||
        }
 | 
			
		||||
        <span class="fiat"><app-fiat [blockConversion]="tx.price" [value]="tx.fee + ((accelerationInfo?.bidBoost ?? tx.feeDelta) || 0)"></app-fiat></span>
 | 
			
		||||
      </td>
 | 
			
		||||
@ -647,9 +647,9 @@
 | 
			
		||||
        <td>
 | 
			
		||||
          <div class="effective-fee-container">
 | 
			
		||||
            @if (accelerationInfo?.acceleratedFeeRate && (!tx.effectiveFeePerVsize || accelerationInfo.acceleratedFeeRate >= tx.effectiveFeePerVsize || tx.acceleration)) {
 | 
			
		||||
              <app-fee-rate [class.oobFees]="isAcceleration" [fee]="accelerationInfo.acceleratedFeeRate"></app-fee-rate>
 | 
			
		||||
              <app-fee-rate [attr.data-cy]="'fee-rate'" [class.oobFees]="isAcceleration" [fee]="accelerationInfo.acceleratedFeeRate"></app-fee-rate>
 | 
			
		||||
            } @else {
 | 
			
		||||
              <app-fee-rate [class.oobFees]="isAcceleration" [fee]="tx.effectiveFeePerVsize"></app-fee-rate>
 | 
			
		||||
              <app-fee-rate [attr.data-cy]="'fee-rate'" [class.oobFees]="isAcceleration" [fee]="tx.effectiveFeePerVsize"></app-fee-rate>
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            @if (tx?.status?.confirmed && !tx.acceleration && !accelerationInfo && tx.fee && tx.effectiveFeePerVsize) {
 | 
			
		||||
@ -670,7 +670,7 @@
 | 
			
		||||
<ng-template #acceleratingRow>
 | 
			
		||||
  <tr>
 | 
			
		||||
    <td rowspan="2" colspan="2" style="padding: 0;">
 | 
			
		||||
      <app-active-acceleration-box [acceleratedBy]="tx.acceleratedBy" [effectiveFeeRate]="tx.effectiveFeePerVsize" [accelerationInfo]="accelerationInfo" [miningStats]="miningStats" [hasCpfp]="hasCpfp" (toggleCpfp)="showCpfpDetails = !showCpfpDetails" [chartPositionLeft]="isMobile"></app-active-acceleration-box>
 | 
			
		||||
      <app-active-acceleration-box [attr.data-cy]="'active-acceleration-box'" [acceleratedBy]="tx.acceleratedBy" [effectiveFeeRate]="tx.effectiveFeePerVsize" [accelerationInfo]="accelerationInfo" [miningStats]="miningStats" [hasCpfp]="hasCpfp" (toggleCpfp)="showCpfpDetails = !showCpfpDetails" [chartPositionLeft]="isMobile"></app-active-acceleration-box>
 | 
			
		||||
    </td>
 | 
			
		||||
  </tr>
 | 
			
		||||
  <tr></tr>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user