diff --git a/backend/src/api/blocks.ts b/backend/src/api/blocks.ts index fc12b5998..bae8e80dc 100644 --- a/backend/src/api/blocks.ts +++ b/backend/src/api/blocks.ts @@ -282,10 +282,12 @@ class Blocks { } extras.matchRate = null; + extras.expectedFees = null; if (config.MEMPOOL.AUDIT) { const auditScore = await BlocksAuditsRepository.$getBlockAuditScore(block.id); if (auditScore != null) { extras.matchRate = auditScore.matchRate; + extras.expectedFees = auditScore.expectedFees; } } } diff --git a/backend/src/api/websocket-handler.ts b/backend/src/api/websocket-handler.ts index 387304165..8d9a74d12 100644 --- a/backend/src/api/websocket-handler.ts +++ b/backend/src/api/websocket-handler.ts @@ -598,6 +598,7 @@ class WebsocketHandler { if (block.extras) { block.extras.matchRate = matchRate; + block.extras.expectedFees = totalFees; block.extras.similarity = similarity; } } diff --git a/backend/src/mempool.interfaces.ts b/backend/src/mempool.interfaces.ts index 8887dd45b..bc73c0a8a 100644 --- a/backend/src/mempool.interfaces.ts +++ b/backend/src/mempool.interfaces.ts @@ -41,6 +41,7 @@ export interface BlockAudit { export interface AuditScore { hash: string, matchRate?: number, + expectedFees?: number } export interface MempoolBlock { @@ -183,6 +184,7 @@ export interface BlockExtension { feeRange: number[]; // fee rate percentiles reward: number; matchRate: number | null; + expectedFees: number | null; similarity?: number; pool: { id: number; // Note - This is the `unique_id`, not to mix with the auto increment `id` diff --git a/backend/src/repositories/BlocksAuditsRepository.ts b/backend/src/repositories/BlocksAuditsRepository.ts index aaac7018c..0e77bdeb7 100644 --- a/backend/src/repositories/BlocksAuditsRepository.ts +++ b/backend/src/repositories/BlocksAuditsRepository.ts @@ -81,7 +81,7 @@ class BlocksAuditRepositories { public async $getBlockAuditScore(hash: string): Promise { try { const [rows]: any[] = await DB.query( - `SELECT hash, match_rate as matchRate + `SELECT hash, match_rate as matchRate, expected_fees as expectedFees FROM blocks_audits WHERE blocks_audits.hash = "${hash}" `); @@ -95,7 +95,7 @@ class BlocksAuditRepositories { public async $getBlockAuditScores(maxHeight: number, minHeight: number): Promise { try { const [rows]: any[] = await DB.query( - `SELECT hash, match_rate as matchRate + `SELECT hash, match_rate as matchRate, expected_fees as expectedFees FROM blocks_audits WHERE blocks_audits.height BETWEEN ? AND ? `, [minHeight, maxHeight]); diff --git a/backend/src/repositories/BlocksRepository.ts b/backend/src/repositories/BlocksRepository.ts index a014e317e..fff9c1b1b 100644 --- a/backend/src/repositories/BlocksRepository.ts +++ b/backend/src/repositories/BlocksRepository.ts @@ -1032,10 +1032,12 @@ class BlocksRepository { // Match rate is not part of the blocks table, but it is part of APIs so we must include it extras.matchRate = null; + extras.expectedFees = null; if (config.MEMPOOL.AUDIT) { const auditScore = await BlocksAuditsRepository.$getBlockAuditScore(dbBlk.id); if (auditScore != null) { extras.matchRate = auditScore.matchRate; + extras.expectedFees = auditScore.expectedFees; } } diff --git a/frontend/src/app/components/blocks-list/blocks-list.component.html b/frontend/src/app/components/blocks-list/blocks-list.component.html index d6c229846..6748da448 100644 --- a/frontend/src/app/components/blocks-list/blocks-list.component.html +++ b/frontend/src/app/components/blocks-list/blocks-list.component.html @@ -16,6 +16,8 @@ Mined Health + Expected fees Reward Fees @@ -64,6 +66,9 @@ + + + diff --git a/frontend/src/app/interfaces/node-api.interface.ts b/frontend/src/app/interfaces/node-api.interface.ts index 53763bbf9..3de82b910 100644 --- a/frontend/src/app/interfaces/node-api.interface.ts +++ b/frontend/src/app/interfaces/node-api.interface.ts @@ -133,6 +133,7 @@ export interface BlockExtension { reward?: number; coinbaseRaw?: string; matchRate?: number; + expectedFees?: number; similarity?: number; pool?: { id: number;