Merge pull request #1893 from majestrate/issue-1892-rpc-ping-pubkey-2022-04-13

add public key in rpc ping
This commit is contained in:
majestrate 2022-04-15 17:55:05 -04:00 committed by GitHub
commit 293bccb6d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -7,6 +7,7 @@
#include <nlohmann/json.hpp>
#include <oxenc/bt.h>
#include <oxenc/hex.h>
#include <llarp/util/time.hpp>
namespace llarp
@ -147,7 +148,12 @@ namespace llarp
constexpr auto PingInterval = 30s;
auto makePingRequest = [self = shared_from_this()]() {
// send a ping
nlohmann::json payload = {{"version", {VERSION[0], VERSION[1], VERSION[2]}}};
PubKey pk{};
if (auto r = self->m_Router.lock())
pk = r->pubkey();
nlohmann::json payload = {
{"pubkey_ed25519", oxenc::to_hex(pk.begin(), pk.end())},
{"version", {VERSION[0], VERSION[1], VERSION[2]}}};
self->Request(
"admin.lokinet_ping",
[](bool success, std::vector<std::string> data) {