Remove fields that won't be used in the frontend for now

This commit is contained in:
nymkappa 2022-02-10 10:25:14 +09:00
parent aa0e6b807a
commit b8e40494aa
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04
4 changed files with 12 additions and 16 deletions

View File

@ -126,12 +126,10 @@ class Blocks {
} else {
pool = await poolsRepository.$getUnknownPool();
}
blockExtended.extras.pool = pool;
if (transactions.length > 0) {
const coinbase: IEsploraApi.Transaction = await bitcoinApi.$getRawTransaction(transactions[0].txid, true);
blockExtended.extras.coinbaseHex = coinbase.hex;
}
blockExtended.extras.pool = {
id: pool.id,
name: pool.name
};
}
return blockExtended;
@ -404,13 +402,9 @@ class Blocks {
medianFee: block?.medianFee,
feeRange: block?.feeRange ?? [], // TODO
reward: block?.reward,
coinbaseHex: block?.extras?.coinbaseHex ?? block?.coinbase_raw, // coinbase_raw for indexed block
pool: block?.extras?.pool ?? (block?.pool_id ? {
id: block?.pool_id,
name: block?.pool_name,
link: block?.pool_link,
regexes: block?.pool_regexes,
addresses: block?.pool_addresses,
} : undefined),
}
};

View File

@ -1,7 +1,7 @@
import { IEsploraApi } from './api/bitcoin/esplora-api.interface';
export interface PoolTag {
id: number | null, // mysql row id
id: number, // mysql row id
name: string,
link: string,
regexes: string, // JSON array
@ -83,8 +83,10 @@ export interface BlockExtension {
reward?: number;
coinbaseTx?: TransactionMinerInfo;
matchRate?: number;
coinbaseHex?: string;
pool?: PoolTag;
pool?: {
id: number;
name: string;
}
}
export interface BlockExtended extends IEsploraApi.Block {

View File

@ -34,7 +34,7 @@ class BlocksRepository {
block.size,
block.weight,
block.tx_count,
block.extras?.coinbaseHex ?? '',
'',
block.difficulty,
block.extras?.pool?.id, // Should always be set to something
0,

View File

@ -7,7 +7,7 @@ class PoolsRepository {
*/
public async $getPools(): Promise<PoolTag[]> {
const connection = await DB.pool.getConnection();
const [rows] = await connection.query('SELECT * FROM pools;');
const [rows] = await connection.query('SELECT id, name, addresses, regexes FROM pools;');
connection.release();
return <PoolTag[]>rows;
}
@ -17,7 +17,7 @@ class PoolsRepository {
*/
public async $getUnknownPool(): Promise<PoolTag> {
const connection = await DB.pool.getConnection();
const [rows] = await connection.query('SELECT * FROM pools where name = "Unknown"');
const [rows] = await connection.query('SELECT id, name FROM pools where name = "Unknown"');
connection.release();
return <PoolTag>rows[0];
}