Skip to content

Commit e53b177

Browse files
committed
test: Dash.estimateFutureBlocks()
1 parent a46ceec commit e53b177

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

tests/calc-start-end-epoch.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,20 @@ let GObj = require("../");
88
const MS_PER_DAY = 24 * 60 * 60 * 1000;
99

1010
function logEstimates(estimates) {
11-
console.log("Measured Seconds per Block", estimates.secondsPerBlock);
12-
console.log("");
11+
console.log(`Until next...`);
12+
13+
let voteDeltaDays = estimates.voteDeltaMs / MS_PER_DAY;
14+
console.log(` Vote (${estimates.voteHeight}):`);
15+
console.log(" Blocks:", estimates.voteDelta);
16+
console.log(" Days:", voteDeltaDays);
17+
console.log(" Date:", estimates.voteIso);
1318

1419
let superblockDeltaDays = estimates.superblockDeltaMs / MS_PER_DAY;
15-
console.log(`Until next Superblock (${estimates.superblockHeight}):`);
20+
console.log(` Superblock (${estimates.superblockHeight}):`);
1621
console.log(" Blocks:", estimates.superblockDelta);
1722
console.log(" Days:", superblockDeltaDays);
1823
console.log(" Date:", estimates.superblockIso);
19-
console.log("");
2024

21-
let voteDeltaDays = estimates.voteDeltaMs / MS_PER_DAY;
22-
console.log(`Until next Vote (${estimates.voteHeight}):`);
23-
console.log(" Blocks:", estimates.voteDelta);
24-
console.log(" Days:", voteDeltaDays);
25-
console.log(" Date:", estimates.voteIso);
2625
console.log("");
2726
}
2827

@@ -33,8 +32,14 @@ function check2024Aug1() {
3332
let currentBlockMs = new Date("2024-08-01 22:01:00");
3433

3534
let estimates = GObj.estimateFutureBlocks(currentBlockMs, currentBlockHeight);
36-
// TODO test outputs for rough legitimacy
37-
logEstimates(estimates);
35+
console.log("Measured Seconds per Block", estimates[0].secondsPerBlock);
36+
console.log("");
37+
console.log(estimates);
38+
39+
for (let estimate of estimates) {
40+
// TODO test outputs for rough legitimacy
41+
logEstimates(estimate);
42+
}
3843
}
3944

4045
check2024Aug1();

0 commit comments

Comments
 (0)