mirror of
https://github.com/mempool/mempool.git
synced 2025-02-24 22:58:30 +01:00
Fix off-by-one error in multi-pool eta calculation
This commit is contained in:
parent
d8cfc6e32d
commit
b64caf8f4b
1 changed files with 2 additions and 2 deletions
|
@ -204,7 +204,7 @@ export class EtaService {
|
||||||
|
|
||||||
let tailProb = 0;
|
let tailProb = 0;
|
||||||
let Q = 0;
|
let Q = 0;
|
||||||
for (let i = 0; i < max; i++) {
|
for (let i = 0; i <= max; i++) {
|
||||||
// find H_i
|
// find H_i
|
||||||
const H = shares.reduce((total, share) => total + (share.block <= i ? share.hashrateShare : 0), 0);
|
const H = shares.reduce((total, share) => total + (share.block <= i ? share.hashrateShare : 0), 0);
|
||||||
// find S_i
|
// find S_i
|
||||||
|
@ -215,7 +215,7 @@ export class EtaService {
|
||||||
tailProb += S;
|
tailProb += S;
|
||||||
}
|
}
|
||||||
// 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 += (1-tailProb);
|
Q += ((max + 1) * (1-tailProb));
|
||||||
const eta = da.timeAvg * Q; // T x Q
|
const eta = da.timeAvg * Q; // T x Q
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Reference in a new issue