Merge pull request #3043 from mempool/nymkappa/bugfix/blocks-api
Fixes blocks api (missing fee range)
This commit is contained in:
commit
3f0bcbe64c
@ -610,7 +610,9 @@ class Blocks {
|
|||||||
const transactions = await this.$getTransactionsExtended(blockHash, block.height, true);
|
const transactions = await this.$getTransactionsExtended(blockHash, block.height, true);
|
||||||
const blockExtended = await this.$getBlockExtended(block, transactions);
|
const blockExtended = await this.$getBlockExtended(block, transactions);
|
||||||
|
|
||||||
await blocksRepository.$saveBlockInDatabase(blockExtended);
|
if (Common.indexingEnabled()) {
|
||||||
|
await blocksRepository.$saveBlockInDatabase(blockExtended);
|
||||||
|
}
|
||||||
|
|
||||||
return prepareBlock(blockExtended);
|
return prepareBlock(blockExtended);
|
||||||
}
|
}
|
||||||
@ -714,7 +716,7 @@ class Blocks {
|
|||||||
block = await this.$indexBlock(currentHeight);
|
block = await this.$indexBlock(currentHeight);
|
||||||
returnBlocks.push(block);
|
returnBlocks.push(block);
|
||||||
} else if (nextHash != null) {
|
} else if (nextHash != null) {
|
||||||
block = prepareBlock(await bitcoinClient.getBlock(nextHash));
|
block = await this.$indexBlock(currentHeight);
|
||||||
nextHash = block.previousblockhash;
|
nextHash = block.previousblockhash;
|
||||||
returnBlocks.push(block);
|
returnBlocks.push(block);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ export function prepareBlock(block: any): BlockExtended {
|
|||||||
extras: {
|
extras: {
|
||||||
coinbaseRaw: block.coinbase_raw ?? block.extras?.coinbaseRaw,
|
coinbaseRaw: block.coinbase_raw ?? block.extras?.coinbaseRaw,
|
||||||
medianFee: block.medianFee ?? block.median_fee ?? block.extras?.medianFee,
|
medianFee: block.medianFee ?? block.median_fee ?? block.extras?.medianFee,
|
||||||
feeRange: block.feeRange ?? block.fee_span,
|
feeRange: block.feeRange ?? block?.extras?.feeRange ?? block.fee_span,
|
||||||
reward: block.reward ?? block?.extras?.reward,
|
reward: block.reward ?? block?.extras?.reward,
|
||||||
totalFees: block.totalFees ?? block?.fees ?? block?.extras?.totalFees,
|
totalFees: block.totalFees ?? block?.fees ?? block?.extras?.totalFees,
|
||||||
avgFee: block?.extras?.avgFee ?? block.avg_fee,
|
avgFee: block?.extras?.avgFee ?? block.avg_fee,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user