Add registername RPC with shared name_new commitment helper#2
Open
mstrofnone wants to merge 1 commit intomasterfrom
Open
Add registername RPC with shared name_new commitment helper#2mstrofnone wants to merge 1 commit intomasterfrom
mstrofnone wants to merge 1 commit intomasterfrom
Conversation
Add a new 'registername' RPC method that provides a simple single-call
interface for name registration: registername "myname" "my-value"
Unlike name_firstupdate (which requires a prior name_new and takes
rand/tx/value as separate positional args), registername takes just
a name and value, handling the commitment automatically:
1. Scan the wallet for a matching name_new commitment.
2. If none is found, create one automatically via name_new.
3. Build the name_firstupdate transaction.
4. If mempool-eligible, broadcast; otherwise commit to wallet for
automatic rebroadcast after the name_new matures.
Refactors the wallet scanning logic from name_firstupdate into a
shared findNameNewCommitment() helper that is reused by both
name_firstupdate and registername. This eliminates the duplicated
wallet scan code and makes the commitment-finding logic testable
independently.
name_firstupdate is completely unchanged in behavior -- power users
can still do the two-step manual procedure.
Returns {txid, rand} as a JSON object.
Includes functional tests covering:
- Basic registration with auto name_new
- Reuse of existing name_new commitment
- Duplicate name rejection
- Default (empty) value
- Parameter validation (name too long, value too long)
- Return format verification
Ref: namecoin#576, namecoin#579, namecoin#581
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.
Add a new
registernameRPC method that provides a simple single-call interface for name registration:Unlike
name_firstupdate(which requires a priorname_newand takes rand/tx/value as separate positional args),registernametakes just a name and value, handling the commitment automatically:name_newcommitment.name_new.name_firstupdatetransaction.name_newmatures.Refactoring
Factors out the wallet scanning logic from
name_firstupdateinto a sharedfindNameNewCommitment()helper that is reused by bothname_firstupdateandregistername. This eliminates duplicated wallet scan code and makes the commitment-finding logic testable independently.The core logic for creating a name_new and building a name_firstupdate is not called via the RPC method
name_new()with all the RPC boilerplate around it, but instead uses the factored-out helper functions directly.name_firstupdateis completely unchanged in behavior — power users can still do the two-step manual procedure.Returns
{txid, rand}as a JSON object.Tests
Includes functional tests (
name_registername.py) covering:name_newname_newcommitmentRef: namecoin#576, namecoin#579, namecoin#581