From d6ec0f2aaeceaa40f9b5e618e53ac1ea1ee5c972 Mon Sep 17 00:00:00 2001 From: Nathan Nichols Date: Wed, 30 Mar 2022 13:02:59 -0500 Subject: [PATCH] round age to zero when negative (#137) --- src/rpc/handlers/ServerInfo.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rpc/handlers/ServerInfo.cpp b/src/rpc/handlers/ServerInfo.cpp index 6ff78860..0651e918 100644 --- a/src/rpc/handlers/ServerInfo.cpp +++ b/src/rpc/handlers/ServerInfo.cpp @@ -54,6 +54,10 @@ doServerInfo(Context const& context) lgrInfo->closeTime.time_since_epoch().count() - 946684800; auto& validatedLgr = (response["validated_ledger"] = boost::json::object{}).as_object(); + + if (age < 0) + age = 0; + validatedLgr["age"] = age; validatedLgr["hash"] = ripple::strHex(lgrInfo->hash); validatedLgr["seq"] = lgrInfo->seq;