Remove fields that won't be used in the frontend for now
This commit is contained in:
		
							parent
							
								
									aa0e6b807a
								
							
						
					
					
						commit
						b8e40494aa
					
				@ -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),
 | 
			
		||||
      }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
@ -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 {
 | 
			
		||||
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user