aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2020-08-15 11:07:02 +0200
committerJon Atack <jon@atack.com>2020-08-15 14:34:37 +0200
commit8a560a7d57cbd9f473d6a3782893a0e2243c55bd (patch)
treeb0f9e66ae90fbda9dd547bf352f102c9405ff016 /src
parent02fbe3ae0bd91cbab2828cb7aa46f6493c82f026 (diff)
downloadbitcoin-8a560a7d57cbd9f473d6a3782893a0e2243c55bd.tar.xz
rpc: expose nLastBlockTime/TXTime as getpeerinfo last_block/transaction
Diffstat (limited to 'src')
-rw-r--r--src/rpc/net.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp
index 9bd7c15992..e9343b3348 100644
--- a/src/rpc/net.cpp
+++ b/src/rpc/net.cpp
@@ -100,6 +100,8 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
{RPCResult::Type::BOOL, "relaytxes", "Whether peer has asked us to relay transactions to it"},
{RPCResult::Type::NUM_TIME, "lastsend", "The " + UNIX_EPOCH_TIME + " of the last send"},
{RPCResult::Type::NUM_TIME, "lastrecv", "The " + UNIX_EPOCH_TIME + " of the last receive"},
+ {RPCResult::Type::NUM_TIME, "last_transaction", "The " + UNIX_EPOCH_TIME + " of the last valid transaction received from this peer"},
+ {RPCResult::Type::NUM_TIME, "last_block", "The " + UNIX_EPOCH_TIME + " of the last block received from this peer"},
{RPCResult::Type::NUM, "bytessent", "The total bytes sent"},
{RPCResult::Type::NUM, "bytesrecv", "The total bytes received"},
{RPCResult::Type::NUM_TIME, "conntime", "The " + UNIX_EPOCH_TIME + " of the connection"},
@@ -169,6 +171,8 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
obj.pushKV("relaytxes", stats.fRelayTxes);
obj.pushKV("lastsend", stats.nLastSend);
obj.pushKV("lastrecv", stats.nLastRecv);
+ obj.pushKV("last_transaction", stats.nLastTXTime);
+ obj.pushKV("last_block", stats.nLastBlockTime);
obj.pushKV("bytessent", stats.nSendBytes);
obj.pushKV("bytesrecv", stats.nRecvBytes);
obj.pushKV("conntime", stats.nTimeConnected);