round age to zero when negative (#137)

This commit is contained in:
Nathan Nichols
2022-03-30 13:02:59 -05:00
committed by GitHub
parent 9b1de77110
commit d6ec0f2aae

View File

@@ -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;