Fix median timestamp field - Fix reponse format when block is indexed on the fly
This commit is contained in:
parent
8612dd2d73
commit
8f716a1d8c
@ -170,6 +170,7 @@ class Blocks {
|
||||
blk.extras.coinbaseTx = transactionUtils.stripCoinbaseTransaction(transactions[0]);
|
||||
blk.extras.coinbaseRaw = blk.extras.coinbaseTx.vin[0].scriptsig;
|
||||
blk.extras.usd = priceUpdater.latestPrices.USD;
|
||||
blk.extras.medianTimestamp = block.medianTime;
|
||||
|
||||
if (block.height === 0) {
|
||||
blk.extras.medianFee = 0; // 50th percentiles
|
||||
@ -204,7 +205,6 @@ class Blocks {
|
||||
|
||||
blk.extras.feePercentiles = [], // TODO
|
||||
blk.extras.medianFeeAmt = 0; // TODO
|
||||
blk.extras.medianTimestamp = block.medianTime; // TODO
|
||||
blk.extras.blockTime = 0; // TODO
|
||||
blk.extras.orphaned = false; // TODO
|
||||
|
||||
@ -785,7 +785,11 @@ class Blocks {
|
||||
while (fromHeight <= toHeight) {
|
||||
let block: any = await blocksRepository.$getBlockByHeight(fromHeight);
|
||||
if (!block) {
|
||||
block = await this.$indexBlock(fromHeight);
|
||||
await this.$indexBlock(fromHeight);
|
||||
block = await blocksRepository.$getBlockByHeight(fromHeight);
|
||||
if (!block) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
delete(block.hash);
|
||||
@ -794,6 +798,7 @@ class Blocks {
|
||||
delete(block.pool_link);
|
||||
delete(block.pool_addresses);
|
||||
delete(block.pool_regexes);
|
||||
delete(block.median_timestamp);
|
||||
|
||||
blocks.push(block);
|
||||
fromHeight++;
|
||||
|
@ -367,6 +367,7 @@ class BlocksRepository {
|
||||
blocks.*,
|
||||
hash as id,
|
||||
UNIX_TIMESTAMP(blocks.blockTimestamp) as blockTimestamp,
|
||||
UNIX_TIMESTAMP(blocks.median_timestamp) as medianTime,
|
||||
pools.id as pool_id,
|
||||
pools.name as pool_name,
|
||||
pools.link as pool_link,
|
||||
|
Loading…
x
Reference in New Issue
Block a user