API: added ZMQ last active timestamp to network/stats

This commit is contained in:
SChernykh 2024-12-29 12:56:32 +01:00
parent 0d33214557
commit fb0dc586b2

View file

@ -1552,13 +1552,15 @@ void p2pool::api_update_network_stats()
} }
m_api->set(p2pool_api::Category::NETWORK, "stats", m_api->set(p2pool_api::Category::NETWORK, "stats",
[mainnet_tip](log::Stream& s) [this, mainnet_tip](log::Stream& s)
{ {
s << "{\"difficulty\":" << mainnet_tip.difficulty s << "{\"difficulty\":" << mainnet_tip.difficulty
<< ",\"hash\":\"" << mainnet_tip.id << ",\"hash\":\"" << mainnet_tip.id
<< "\",\"height\":" << mainnet_tip.height << "\",\"height\":" << mainnet_tip.height
<< ",\"reward\":" << mainnet_tip.reward << ",\"reward\":" << mainnet_tip.reward
<< ",\"timestamp\":" << mainnet_tip.timestamp << "}"; << ",\"timestamp\":" << mainnet_tip.timestamp
<< ",\"zmq_last_active\":" << zmq_last_active()
<< "}";
}); });
api_update_stats_mod(); api_update_stats_mod();