Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport: bitcoin#21679, #21913 - RPC default argument #6306

Merged
merged 3 commits into from
Oct 5, 2024

Conversation

knst
Copy link
Collaborator

@knst knst commented Oct 4, 2024

What was done?

Backport bitcoin#21679, bitcoin#21913 which keep default argument value in correct type and some extra fixes and apply fixes for Dash specific code.

How Has This Been Tested?

Run unit/functional tests.

Breaking Changes

It doesn't actually change behavior, just improve implementation of default arguments and help for RPC.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone

src/rpc/blockchain.cpp Outdated Show resolved Hide resolved
@knst knst force-pushed the bp-v22-p20 branch 3 times, most recently from 2648587 to 2aa0761 Compare October 4, 2024 11:41
knst and others added 3 commits October 4, 2024 18:42
bee56c7 rpc: Check default value type againts argument type (João Barbosa)
f81ef43 rpc: Keep default argument value in correct type (João Barbosa)

Pull request description:

  Store default values of RPC arguments in the corresponding type instead of a string. The value is then serialized when the help output is needed. This change simplifies bitcoin#20017.

  The following examples illustrates how to use the new `RPCArg::Default` and `RPCArg::DefaultHint`:

  ```diff
  - {"verbose", RPCArg::Type::BOOL, /* default */ "false", "True for a json object, false for array of transaction ids"}
  + {"verbose", RPCArg::Type::BOOL, RPCArg::Default(false), "True for a json object, false for array of transaction ids"}
  ```

  ```diff
  - {"nblocks", RPCArg::Type::NUM, /* default */ "one month", "Size of the window in number of blocks"}
  + {"nblocks", RPCArg::Type::NUM, RPCArg::DefaultHint("one month"), "Size of the window in number of blocks"}
  ```

  No behavior change is expected.

ACKs for top commit:
  LarryRuane:
    ACK bee56c7
  MarcoFalke:
    ACK bee56c7 🦅

Tree-SHA512: c47d78c918e996d36631d4ad3c933b270a34c5b446b8d736be94cf4a0a7b8c0e33d954149ec786cf9550639865b79deb6a130ad044de6030f95aac33f524293a
6e2eb0d rpc/wallet: use OMITTED_NAMED_ARG instead of Default(VNULL) (Karl-Johan Alm)
4983f4c rpc/createwallet: omitted named arguments (Karl-Johan Alm)
dc4db23 rpc: address:amount dictionaries are OBJ_USER_KEYS (Karl-Johan Alm)
c8cf0a3 rpc/getpeerinfo: bytesrecv_per_msg is a dynamic dictionary (Karl-Johan Alm)
eb4fb7e rpc/gettxoutsetinfo: hash_or_height is a named argument (Karl-Johan Alm)

Pull request description:

  This is a follow-up to bitcoin#21897, and I believe covers the remaining cases, at least that I could find.

  Edited to remove unrelated information about a side project.

ACKs for top commit:
  laanwj:
    Documentation diff ACK 6e2eb0d
  promag:
    Code review ACK 6e2eb0d.

Tree-SHA512: d26f6e074e13d64bbca2a114a0adc7f905d47d238c4e9bc49f70ca0b775afbebf9879fc3794ab29dc316a6dbd00ba8cbeb01197e236ee4ab2e9854db25f23f04
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK 0c3c732

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

utACK 0c3c732

@PastaPastaPasta PastaPastaPasta merged commit 809eb55 into dashpay:develop Oct 5, 2024
37 of 38 checks passed
@knst knst deleted the bp-v22-p20 branch October 7, 2024 19:57
@knst knst added the RPC Some notable changes to RPC params/behaviour/descriptions label Oct 7, 2024
@UdjinM6 UdjinM6 added this to the 22 milestone Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RPC Some notable changes to RPC params/behaviour/descriptions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants