Don't send back difficulty adjustment info

This commit is contained in:
Mononaut 2023-03-26 09:05:41 +09:00
parent 5f60cb821a
commit edfbede704
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E
2 changed files with 8 additions and 3 deletions

View File

@ -211,6 +211,7 @@ class WebsocketHandler {
if (!_blocks) {
_blocks = blocks.getBlocks().slice(-config.MEMPOOL.INITIAL_BLOCKS_AMOUNT);
}
const da = difficultyAdjustment.getDifficultyAdjustment();
return {
'mempoolInfo': memPool.getMempoolInfo(),
'vBytesPerSecond': memPool.getVBytesPerSecond(),
@ -220,7 +221,7 @@ class WebsocketHandler {
'transactions': memPool.getLatestTransactions(),
'backendInfo': backendInfo.getBackendInfo(),
'loadingIndicators': loadingIndicators.getLoadingIndicators(),
'da': difficultyAdjustment.getDifficultyAdjustment(),
'da': da?.previousTime ? da : undefined,
'fees': feeApi.getRecommendedFee(),
...this.extraInitProperties
};
@ -278,7 +279,9 @@ class WebsocketHandler {
response['mempoolInfo'] = mempoolInfo;
response['vBytesPerSecond'] = vBytesPerSecond;
response['transactions'] = newTransactions.slice(0, 6).map((tx) => Common.stripTransaction(tx));
response['da'] = da;
if (da?.previousTime) {
response['da'] = da;
}
response['fees'] = recommendedFees;
}
@ -505,7 +508,7 @@ class WebsocketHandler {
const response = {
'block': block,
'mempoolInfo': memPool.getMempoolInfo(),
'da': da,
'da': da?.previousTime ? da : undefined,
'fees': fees,
};

View File

@ -309,9 +309,11 @@ export interface IDifficultyAdjustment {
remainingBlocks: number;
remainingTime: number;
previousRetarget: number;
previousTime: number;
nextRetargetHeight: number;
timeAvg: number;
timeOffset: number;
expectedBlocks: number;
}
export interface IndexedDifficultyAdjustment {