Merge pull request #932 from MiguelMedeiros/fix-empty-mempool-blocks

Fix: mempool empty block.
This commit is contained in:
softsimon 2021-11-16 00:26:15 +04:00 committed by GitHub
commit cfec9345c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 4 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,12 +88,17 @@ export class MempoolBlocksComponent implements OnInit, OnDestroy {
block.blink = specialBlocks[block.height] ? true : false;
}
});
if (!mempoolBlocks.length) {
const emptyBlock = [{ index: 0, blockSize: 0, blockVSize: 0, feeRange: [0, 0], medianFee: 0, nTx: 0, totalFees: 0 }];
this.mempoolBlocks = emptyBlock;
} else {
const stringifiedBlocks = JSON.stringify(mempoolBlocks);
this.mempoolBlocksFull = JSON.parse(stringifiedBlocks);
this.mempoolBlocks = this.reduceMempoolBlocksToFitScreen(JSON.parse(stringifiedBlocks));
}
this.updateMempoolBlockStyles();
this.calculateTransactionPosition();
return this.mempoolBlocks;
})
);