fix: mempool empty block.

This commit is contained in:
Miguel Medeiros 2021-11-15 14:16:27 -03:00
parent 475f9344a0
commit 0639ce9b07
No known key found for this signature in database
GPG Key ID: 819EDEE4673F3EBB
5 changed files with 32 additions and 5 deletions

View File

@ -18,6 +18,12 @@ describe('Liquid', () => {
if (baseModule === 'mempool' || baseModule === 'liquid') {
it('check first mempool block after skeleton loads', () => {
cy.visit(`${basePath}`);
cy.waitForSkeletonGone();
cy.get('#mempool-block-0 > .blockLink').should('exist');
});
it('loads the dashboard', () => {
cy.visit(`${basePath}`);
cy.waitForSkeletonGone();

View File

@ -24,6 +24,12 @@ describe('Mainnet', () => {
if (baseModule === 'mempool') {
it('check first mempool block after skeleton loads', () => {
cy.visit('/');
cy.waitForSkeletonGone();
cy.get('#mempool-block-0 > .blockLink').should('exist');
});
it('loads the status screen', () => {
cy.visit('/status');
cy.get('#mempool-block-0').should('be.visible');

View File

@ -17,6 +17,12 @@ describe('Signet', () => {
cy.waitForSkeletonGone();
});
it('check first mempool block after skeleton loads', () => {
cy.visit('/');
cy.waitForSkeletonGone();
cy.get('#mempool-block-0 > .blockLink').should('exist');
});
it('loads the dashboard with the skeleton blocks', () => {
cy.mockMempoolSocket();
cy.visit("/signet");

View File

@ -17,6 +17,12 @@ describe('Testnet', () => {
cy.waitForSkeletonGone();
});
it('check first mempool block after skeleton loads', () => {
cy.visit('/');
cy.waitForSkeletonGone();
cy.get('#mempool-block-0 > .blockLink').should('exist');
});
it('loads the dashboard with the skeleton blocks', () => {
cy.mockMempoolSocket();
cy.visit("/testnet");

View File

@ -88,13 +88,16 @@ export class MempoolBlocksComponent implements OnInit, OnDestroy {
block.blink = specialBlocks[block.height] ? true : false;
}
});
const stringifiedBlocks = JSON.stringify(mempoolBlocks);
this.mempoolBlocksFull = JSON.parse(stringifiedBlocks);
this.mempoolBlocks = this.reduceMempoolBlocksToFitScreen(JSON.parse(stringifiedBlocks));
let blocks = mempoolBlocks;
if (!mempoolBlocks.length) {
blocks = [{ index: 0, blockSize: 0, blockVSize: 0, feeRange: [0, 0], medianFee: 0, nTx: 0, totalFees: 0 }];
}
this.mempoolBlocksFull = blocks;
this.mempoolBlocks = this.reduceMempoolBlocksToFitScreen(blocks);
this.updateMempoolBlockStyles();
this.calculateTransactionPosition();
return this.mempoolBlocks;
return blocks;
})
);