rpc: expose node generation identity - #1578
Open
Abdullah1738 wants to merge 1 commit into
Open
Conversation
Member
|
CI fails on the rpc fuzz target: new commands must be added to one of the allowlists in src/test/fuzz/rpc.cpp. Please add getnodegeneration to the ELEMENTS section of RPC_COMMANDS_SAFE_FOR_FUZZING. |
Member
|
What is the immediate use case? Ideally, this could be added upstream to bitcoin first (but that of course would take longer to feed through if required sooner). If I understand correctly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Clients that depend on a coherent direct-RPC view need to distinguish a stale response from a current response after daemon restart, and need to detect reorg-away/reorg-back ABA even when height and best block hash return to their prior values.
Change
Add a read-only
getnodegenerationRPC returning one atomic snapshot:{ "startup_id": "<64 lowercase hexadecimal characters>", "chainstate_revision": 1, "blocks": 0, "bestblockhash": "<64 lowercase hexadecimal characters>" }startup_idis a fresh process-local 256-bit value initialized from the node RNGchainstate_revisionadvances undercs_mainwhen the active chainstate tip or active chainstate identity changesThe RPC is observational only: it does not change consensus, persistence, P2P, wallet behavior, or startup arguments.
Local verification
test_elementsunit suite passed (607 cases)rpc_testssuite passed (15 cases)validation_chainstatemanager_testssuite passed (8 cases)rpc_getnodegeneration.pypassed with RPC documentation checksrpc_blockchain.py --v1transportpassedfeature_assumeutxo.pypassedThe functional coverage includes clean and forced restarts over the same data directory, exact connect/disconnect increments, reorg-away/reorg-back ABA, concurrent sampling, and rejection of arguments.