diff --git a/backend/src/api/blocks.ts b/backend/src/api/blocks.ts index bde5bcea9..922c0e639 100644 --- a/backend/src/api/blocks.ts +++ b/backend/src/api/blocks.ts @@ -108,9 +108,7 @@ class Blocks { const blockExtended: BlockExtended = Object.assign({ extras: {} }, block); blockExtended.extras.reward = transactions[0].vout.reduce((acc, curr) => acc + curr.value, 0); blockExtended.extras.coinbaseTx = transactionUtils.stripCoinbaseTransaction(transactions[0]); - - const coinbaseRaw: IEsploraApi.Transaction = await bitcoinApi.$getRawTransaction(transactions[0].txid, true, false, block.id); - blockExtended.extras.coinbaseRaw = coinbaseRaw.hex; + blockExtended.extras.coinbaseRaw = blockExtended.extras.coinbaseTx.vin[0].scriptsig; if (block.height === 0) { blockExtended.extras.medianFee = 0; // 50th percentiles @@ -410,6 +408,7 @@ class Blocks { weight: block.weight, previousblockhash: block.previousblockhash, extras: { + coinbaseRaw: block.coinbase_raw ?? block.extras.coinbaseRaw, medianFee: block.medianFee ?? block.median_fee ?? block.extras?.medianFee, feeRange: block.feeRange ?? block.fee_range ?? block?.extras?.feeSpan, reward: block.reward ?? block?.extras?.reward, diff --git a/backend/src/api/database-migration.ts b/backend/src/api/database-migration.ts index c9c1da8e8..ffa9041e3 100644 --- a/backend/src/api/database-migration.ts +++ b/backend/src/api/database-migration.ts @@ -6,7 +6,7 @@ import logger from '../logger'; const sleep = (ms: number) => new Promise(res => setTimeout(res, ms)); class DatabaseMigration { - private static currentVersion = 14; + private static currentVersion = 15; private queryTimeout = 120000; private statisticsAddedIndexed = false; diff --git a/backend/src/repositories/BlocksRepository.ts b/backend/src/repositories/BlocksRepository.ts index 0af5e2252..4ac0a9d9d 100644 --- a/backend/src/repositories/BlocksRepository.ts +++ b/backend/src/repositories/BlocksRepository.ts @@ -56,7 +56,7 @@ class BlocksRepository { logger.debug(`$saveBlockInDatabase() - Block ${block.height} has already been indexed, ignoring`); } else { connection.release(); - logger.err('$saveBlockInDatabase() error' + (e instanceof Error ? e.message : e)); + logger.err('$saveBlockInDatabase() error: ' + (e instanceof Error ? e.message : e)); throw e; } } 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 f50a5fff2..cb301e992 100644 --- a/frontend/src/app/components/blocks-list/blocks-list.component.html +++ b/frontend/src/app/components/blocks-list/blocks-list.component.html @@ -24,11 +24,14 @@ }} - - - {{ block.extras.pool.name }} - +
+ + + {{ block.extras.pool.name }} + + {{ block.extras.coinbaseRaw | hex2ascii }} +
‎{{ block.timestamp * 1000 | date:'yyyy-MM-dd HH:mm' }} diff --git a/frontend/src/app/components/blocks-list/blocks-list.component.scss b/frontend/src/app/components/blocks-list/blocks-list.component.scss index 9414348c1..3ea6e42f9 100644 --- a/frontend/src/app/components/blocks-list/blocks-list.component.scss +++ b/frontend/src/app/components/blocks-list/blocks-list.component.scss @@ -122,3 +122,27 @@ td { display: none; } } + +/* Tooltip text */ +.tooltip-custom { + position: relative; +} + +.tooltip-custom .tooltiptext { + visibility: hidden; + background-color: black; + color: #fff; + text-align: center; + padding: 5px 0; + border-radius: 6px; + position: absolute; + z-index: 1; + // width: 120px; + top: -40px; + left: 0; +} + +/* Show the tooltip text when you mouse over the tooltip container */ +.tooltip-custom:hover .tooltiptext { + visibility: visible; +} \ No newline at end of file diff --git a/frontend/src/app/interfaces/node-api.interface.ts b/frontend/src/app/interfaces/node-api.interface.ts index 8caba7496..c8118add7 100644 --- a/frontend/src/app/interfaces/node-api.interface.ts +++ b/frontend/src/app/interfaces/node-api.interface.ts @@ -102,6 +102,7 @@ export interface BlockExtension { feeRange?: number[]; reward?: number; coinbaseTx?: Transaction; + coinbaseRaw?: string; matchRate?: number; pool?: { id: number; diff --git a/frontend/src/app/shared/pipes/hex2ascii/hex2ascii.pipe.ts b/frontend/src/app/shared/pipes/hex2ascii/hex2ascii.pipe.ts index 3d62ae7d6..09b3df762 100644 --- a/frontend/src/app/shared/pipes/hex2ascii/hex2ascii.pipe.ts +++ b/frontend/src/app/shared/pipes/hex2ascii/hex2ascii.pipe.ts @@ -15,11 +15,11 @@ export class Hex2asciiPipe implements PipeTransform { if (!hex) { return ''; } - let bytes: number[] = []; + const bytes: number[] = []; for (let i = 0; i < hex.length; i += 2) { bytes.push(parseInt(hex.substr(i, 2), 16)); } - return new TextDecoder('utf8').decode(Uint8Array.from(bytes)); + return new TextDecoder('utf8').decode(Uint8Array.from(bytes)).replace(/\uFFFD/g, '').replace(/\\0/g, ''); } }