Merge pull request #5579 from mempool/natsoni/use-adjusted-time-avg

Use adjusted block time for difficulty and ETA calculation
This commit is contained in:
softsimon 2024-12-22 15:59:52 +07:00 committed by GitHub
commit 734d5f2461
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -45,7 +45,7 @@
<div class="difficulty-stats"> <div class="difficulty-stats">
<div class="item"> <div class="item">
<div class="card-text"> <div class="card-text">
~<app-time [time]="epochData.timeAvg / 1000" [fractionDigits]="1"></app-time> ~<app-time [time]="epochData.adjustedTimeAvg / 1000" [fractionDigits]="1"></app-time>
</div> </div>
<div class="symbol" i18n="difficulty-box.average-block-time">Average block time</div> <div class="symbol" i18n="difficulty-box.average-block-time">Average block time</div>
</div> </div>

View file

@ -55,7 +55,7 @@ export class EtaService {
return { return {
hashratePercentage: acceleratingHashrateFraction * 100, hashratePercentage: acceleratingHashrateFraction * 100,
ETA: Date.now() + da.timeAvg * mempoolPosition.block, ETA: Date.now() + da.adjustedTimeAvg * mempoolPosition.block,
acceleratedETA: this.calculateETAFromShares([ acceleratedETA: this.calculateETAFromShares([
{ block: mempoolPosition.block, hashrateShare: (1 - acceleratingHashrateFraction) }, { block: mempoolPosition.block, hashrateShare: (1 - acceleratingHashrateFraction) },
{ block: 0, hashrateShare: acceleratingHashrateFraction }, { block: 0, hashrateShare: acceleratingHashrateFraction },
@ -216,7 +216,7 @@ export class EtaService {
} }
// at max depth, the transaction is guaranteed to be mined in the next block if it hasn't already // at max depth, the transaction is guaranteed to be mined in the next block if it hasn't already
Q += ((max + 1) * (1-tailProb)); Q += ((max + 1) * (1-tailProb));
const eta = da.timeAvg * Q; // T x Q const eta = da.adjustedTimeAvg * Q; // T x Q
return { return {
now, now,