Skip to content

Commit

Permalink
Fix timestamp validation test (#7124)
Browse files Browse the repository at this point in the history
* +1 on the timestamp

Signed-off-by: Sally MacFarlane <[email protected]>

---------

Signed-off-by: Sally MacFarlane <[email protected]>
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
  • Loading branch information
macfarla and devin-ai-integration[bot] authored May 31, 2024
1 parent e68c4e1 commit 64de9f2
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ public void headerNewerThanCurrentSystemFailsValidation() {
final BlockHeader parent = headerBuilder.buildHeader();

// Create header for validation with a timestamp in the future (1 second too far away)
headerBuilder.timestamp(parent.getTimestamp() + acceptableClockDrift + 1);
// (+1 to avoid spurious failures)
headerBuilder.timestamp(parent.getTimestamp() + acceptableClockDrift + 2);
final BlockHeader header = headerBuilder.buildHeader();

assertThat(uut00.validate(header, parent)).isFalse();
Expand All @@ -124,7 +125,7 @@ public void futureHeadersAreValidIfTimestampWithinTolerance() {
TimeUnit.SECONDS.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS));
final BlockHeader parent = headerBuilder.buildHeader();

// Create header for validation with a timestamp in the future (1 second too far away)
// Create header for validation with a timestamp an acceptable amount in the future
// (-1) to prevent spurious failures
headerBuilder.timestamp(parent.getTimestamp() + acceptableClockDrift - 1);
final BlockHeader header = headerBuilder.buildHeader();
Expand Down

0 comments on commit 64de9f2

Please sign in to comment.