Skip to content

rpc: add expiry field to getgeneralinfo#247

Open
Retropex wants to merge 1 commit intobitcoinknots:29.x-knotsfrom
Retropex:rpcexpiry
Open

rpc: add expiry field to getgeneralinfo#247
Retropex wants to merge 1 commit intobitcoinknots:29.x-knotsfrom
Retropex:rpcexpiry

Conversation

@Retropex
Copy link

Useful for external software who want to be able to fetch when bitcoind will expire.

@TH3BAT
Copy link

TH3BAT commented Jan 14, 2026

Knots exposing expiry via RPC is the correct layer.
Expiry is node self-knowledge, not something a dashboard should infer or scrape from logs. An explicit getexpiry (or similar) RPC keeps it authoritative and future-proof.

@luke-jr
Copy link
Collaborator

luke-jr commented Jan 22, 2026

Not sure having its own RPC makes sense. Maybe one of the existing get*info is a good place?

@Retropex
Copy link
Author

Make sense, I will update

@Retropex Retropex force-pushed the rpcexpiry branch 2 times, most recently from 5b1eef4 to 86b4d02 Compare February 2, 2026 09:59
{RPCResult::Type::STR, "datadir", "Data directory path"},
{RPCResult::Type::STR, "blocksdir", "Blocks directory path"},
{RPCResult::Type::NUM, "startuptime", "Startup time"},
{RPCResult::Type::NUM_TIME, "expiry", "Expiry timestamp"},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will type-mismatch if boolean

src/rpc/node.cpp Outdated
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
const ArgsManager& args{EnsureAnyArgsman(request.context)};
int64_t expiry = g_software_expiry <= 0 ? false : g_software_expiry;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will turn the false into a 0.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get it, isn't false == 0?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in JSON. Booleans and Numbers are distinct types.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think returning two different type for the same entry is a good idea.
We should keep zero as a special value to signal that it's disabled, as it's done in bitcoin.conf

@Retropex Retropex changed the title rpc: add getexpiry call rpc: add expiry field to getgeneralinfo Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments