Skip to content

Commit 8a560a7

Browse files
committed
rpc: expose nLastBlockTime/TXTime as getpeerinfo last_block/transaction
1 parent 02fbe3a commit 8a560a7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/rpc/net.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
100100
{RPCResult::Type::BOOL, "relaytxes", "Whether peer has asked us to relay transactions to it"},
101101
{RPCResult::Type::NUM_TIME, "lastsend", "The " + UNIX_EPOCH_TIME + " of the last send"},
102102
{RPCResult::Type::NUM_TIME, "lastrecv", "The " + UNIX_EPOCH_TIME + " of the last receive"},
103+
{RPCResult::Type::NUM_TIME, "last_transaction", "The " + UNIX_EPOCH_TIME + " of the last valid transaction received from this peer"},
104+
{RPCResult::Type::NUM_TIME, "last_block", "The " + UNIX_EPOCH_TIME + " of the last block received from this peer"},
103105
{RPCResult::Type::NUM, "bytessent", "The total bytes sent"},
104106
{RPCResult::Type::NUM, "bytesrecv", "The total bytes received"},
105107
{RPCResult::Type::NUM_TIME, "conntime", "The " + UNIX_EPOCH_TIME + " of the connection"},
@@ -169,6 +171,8 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
169171
obj.pushKV("relaytxes", stats.fRelayTxes);
170172
obj.pushKV("lastsend", stats.nLastSend);
171173
obj.pushKV("lastrecv", stats.nLastRecv);
174+
obj.pushKV("last_transaction", stats.nLastTXTime);
175+
obj.pushKV("last_block", stats.nLastBlockTime);
172176
obj.pushKV("bytessent", stats.nSendBytes);
173177
obj.pushKV("bytesrecv", stats.nRecvBytes);
174178
obj.pushKV("conntime", stats.nTimeConnected);

0 commit comments

Comments
 (0)