Skip to content

fix: Use a single timestamp in server_info - #3156

Open
snowyukitty wants to merge 1 commit into
XRPLF:developfrom
snowyukitty:fix/server-info-single-timestamp
Open

fix: Use a single timestamp in server_info#3156
snowyukitty wants to merge 1 commit into
XRPLF:developfrom
snowyukitty:fix/server-info-single-timestamp

Conversation

@snowyukitty

Copy link
Copy Markdown

server_info sampled system_clock once when constructing InfoSection::time
and again when calculating validated_ledger.age. If those samples straddled a
whole-second boundary, the exact-age assertions could fail intermittently.

This change reuses the timestamp already stored in output.info.time for the
age calculation. The clock remains system_clock by default; making it
injectable lets the tests use fixed absolute ledger times and verify that
successful requests sample it exactly once. A regression test also preserves
the existing zero clamp for future close times.

Fix #2353

Testing

  • RPCServerInfoHandlerTest.*: 12 passed; repeated 100 times (1,200 executions)
  • Adjacent RPC handler and ledger tests: 75 passed
  • Full unit suite: 3,294 passed, 1 disabled
  • GCC 15.2 Release with -Werror; affected Clang 19 translation units
  • clang-format 22.1.8, clang-tidy, C++ pre-commit hooks, codespell, and Doxygen
    1.14.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test in RPCServerInfoHandlerTest

1 participant