Blockchain changes
This commit is contained in:
parent
79b73cb741
commit
6a1a08f59d
@ -668,7 +668,7 @@ export class BlockchainBlockController {
|
||||
const BlockchainPreviousBlockFetchQuery = await getRepository(
|
||||
BlockchainBlock,
|
||||
).findOne({
|
||||
select: ['TotalDifficultyCuckaroo','TotalDifficultyCuckatoo','TotalDifficultyProgpow','TotalDifficultyRandomx'],
|
||||
select: ['TotalDifficultyCuckaroo', 'TotalDifficultyCuckatoo', 'TotalDifficultyProgpow', 'TotalDifficultyRandomx'],
|
||||
where: { Hash: BlockchainBlockFetchQuery.PreviousId },
|
||||
});
|
||||
BlockchainBlockFetchQuery['TargetDifficultyCuckaroo'] =
|
||||
@ -725,7 +725,7 @@ export class BlockchainBlockController {
|
||||
})
|
||||
: next(new NoDataFoundException());
|
||||
} catch (error) {
|
||||
console.log('error',error);
|
||||
console.log('error', error);
|
||||
next(new InternalServerErrorException(error));
|
||||
}
|
||||
};
|
||||
@ -859,41 +859,49 @@ export class BlockchainBlockController {
|
||||
const BlockchainPreviousBlockFetchQuery = await getRepository(
|
||||
BlockchainBlock,
|
||||
).findOne({
|
||||
select: ['TotalDifficultyCuckaroo','TotalDifficultyCuckatoo','TotalDifficultyProgpow','TotalDifficultyRandomx'],
|
||||
select: ['TotalDifficultyCuckaroo', 'TotalDifficultyCuckatoo', 'TotalDifficultyProgpow', 'TotalDifficultyRandomx'],
|
||||
where: { Hash: lastElemt.previous_id },
|
||||
});
|
||||
|
||||
BlockchainBlockResult[BlockchainBlockResult.length - 1][
|
||||
'target_difficulty_cuckaroo'
|
||||
] =
|
||||
] = BlockchainPreviousBlockFetchQuery &&
|
||||
BlockchainPreviousBlockFetchQuery != undefined ?
|
||||
(parseInt(lastElemt.blockchain_block_total_difficulty_cuckaroo)
|
||||
? parseInt(lastElemt.blockchain_block_total_difficulty_cuckaroo)
|
||||
: 0) -
|
||||
parseInt(BlockchainPreviousBlockFetchQuery.TotalDifficultyCuckaroo);
|
||||
(parseInt(BlockchainPreviousBlockFetchQuery.TotalDifficultyCuckaroo) ? parseInt(BlockchainPreviousBlockFetchQuery.TotalDifficultyCuckaroo) : 0)
|
||||
: 0;
|
||||
|
||||
BlockchainBlockResult[BlockchainBlockResult.length - 1][
|
||||
'target_difficulty_cuckatoo'
|
||||
] =
|
||||
] = BlockchainPreviousBlockFetchQuery &&
|
||||
BlockchainPreviousBlockFetchQuery != undefined ?
|
||||
(parseInt(lastElemt.blockchain_block_total_difficulty_cuckatoo)
|
||||
? parseInt(lastElemt.blockchain_block_total_difficulty_cuckatoo)
|
||||
: 0) -
|
||||
parseInt(BlockchainPreviousBlockFetchQuery.TotalDifficultyCuckatoo);
|
||||
(parseInt(BlockchainPreviousBlockFetchQuery.TotalDifficultyCuckatoo) ? parseInt(BlockchainPreviousBlockFetchQuery.TotalDifficultyCuckatoo) : 0)
|
||||
: 0;
|
||||
|
||||
BlockchainBlockResult[BlockchainBlockResult.length - 1][
|
||||
'target_difficulty_progpow'
|
||||
] =
|
||||
] = BlockchainPreviousBlockFetchQuery &&
|
||||
BlockchainPreviousBlockFetchQuery != undefined ?
|
||||
(parseInt(lastElemt.blockchain_block_total_difficulty_progpow)
|
||||
? parseInt(lastElemt.blockchain_block_total_difficulty_progpow)
|
||||
: 0) -
|
||||
parseInt(BlockchainPreviousBlockFetchQuery.TotalDifficultyProgpow);
|
||||
(parseInt(BlockchainPreviousBlockFetchQuery.TotalDifficultyProgpow) ? parseInt(BlockchainPreviousBlockFetchQuery.TotalDifficultyProgpow) : 0)
|
||||
: 0;
|
||||
|
||||
BlockchainBlockResult[BlockchainBlockResult.length - 1][
|
||||
'target_difficulty_randomx'
|
||||
] =
|
||||
] = BlockchainPreviousBlockFetchQuery &&
|
||||
BlockchainPreviousBlockFetchQuery != undefined ?
|
||||
(parseInt(lastElemt.blockchain_block_total_difficulty_randomx)
|
||||
? parseInt(lastElemt.blockchain_block_total_difficulty_randomx)
|
||||
: 0) -
|
||||
parseInt(BlockchainPreviousBlockFetchQuery.TotalDifficultyRandomx);
|
||||
(parseInt(BlockchainPreviousBlockFetchQuery.TotalDifficultyRandomx) ? parseInt(BlockchainPreviousBlockFetchQuery.TotalDifficultyRandomx) : 0)
|
||||
: 0;
|
||||
|
||||
BlockchainBlockResult.forEach(e => {
|
||||
var latest_block = this.dateDiff(e.blockchain_block_timestamp);
|
||||
@ -921,7 +929,7 @@ export class BlockchainBlockController {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('error',error);
|
||||
console.log('error', error);
|
||||
next(new InternalServerErrorException(error));
|
||||
}
|
||||
};
|
||||
@ -1144,7 +1152,7 @@ export class BlockchainBlockController {
|
||||
let date = [],
|
||||
hashrate29 = [],
|
||||
hashrate31 = [];
|
||||
HashRateQueryAR29.forEach(function(e, index) {
|
||||
HashRateQueryAR29.forEach(function (e, index) {
|
||||
if (index > 0) {
|
||||
date.push(moment(e.hour).format('YYYY-MM-DD'));
|
||||
hashrate29.push(
|
||||
@ -1152,7 +1160,7 @@ export class BlockchainBlockController {
|
||||
);
|
||||
}
|
||||
});
|
||||
HashRateQueryAT31.forEach(function(e, index) {
|
||||
HashRateQueryAT31.forEach(function (e, index) {
|
||||
if (index > 0) {
|
||||
hashrate31.push(
|
||||
Math.round((parseInt(e.hashrate) / 1000000000) * 100) / 100,
|
||||
@ -1578,5 +1586,5 @@ export class BlockchainBlockController {
|
||||
} catch (error) {
|
||||
next(new InternalServerErrorException(error));
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user