This PR adds a ban_duration and time_remaining field to the listbanned RPC command. Thanks to jonatack, this PR also expands the listbanned test coverage to include these new fields
It's useful to keep track of ban_duration as this is another data point on which to sort banned peers. I found this helpful in adding additional context columns to the GUI bantablemodel as part of a follow-up PR. As suggested by jonatack, time_remaining is another useful user-centric data point.
Since a ban always expires after its created, the ban_created field is now placed before the banned_until field. This new ordering is more logical.
This PR also improves the help listbanned output by providing additional context to the descriptions of the address, ban_created, and banned_until fields.
Master: listbanned
[
{
"address": "1.2.3.4/32",
"banned_until": 1617691101,
"ban_created": 1617604701
},
{
"address": "135.181.41.129/32",
"banned_until": 1649140716,
"ban_created": 1617604716
}
]
PR: listbanned
[
{
"address": "1.2.3.4/32",
"ban_created": 1617775773,
"banned_until": 1617862173,
"ban_duration": 86400,
"time_remaining": 86392
},
{
"address": "3.114.211.172/32",
"ban_created": 1617753165,
"banned_until": 1618357965,
"ban_duration": 604800,
"time_remaining": 582184
}
]