This PR adds inbound peer eviction criteria nLastBlockTime
and nLastTXTime
to CNodeStats
and CNode::copyStats
, which then allows exposing them in the next commit as last_transaction
and last_block
Unix Epoch Time fields in RPC getpeerinfo
.
This may be useful for writing missing eviction tests. I’d also like to add lasttx
and lastblk
columns to the -netinfo
dashboard as described in #19643 (comment).
Relevant discussion at the p2p irc meeting http://www.erisian.com.au/bitcoin-core-dev/log-2020-08-11.html#l-549:
0<jonatack> i was specifically trying to observe and figure out how to test [#19500](/bitcoin-bitcoin/19500/)
1<jonatack> which made me realise that i didn't know what was going on with my peer conns in enough detail
2<jonatack> i'm running bitcoin locally with nLastBlockTime and nLastTXTime added to getpeerinfo for my peer connections dashboard
3<jonatack> sipa: is there a good reason why that (eviction criteria) data is not exposed through getpeerinfo currently?
4<sipa> jonatack: nope; i suspect just nobody ever added it
5<jonatack> sipa: thanks. will propose.
The last commit is optional, but I think it would be good to have logging in rpc_net.py
.