bitcoin/test/functional/test_framework
Andrew Chow a63192afb8
Merge bitcoin/bitcoin#19762: rpc: Allow named and positional arguments to be used together
d8b12a75db rpc: Allow named and positional arguments to be used together (Ryan Ofsky)

Pull request description:

  It's nice to be able to use named options and positional arguments together.

  Most shell tools accept both, and python functions combine options and arguments allowing them to be passed with even more flexibility. This change adds support for python's approach so as a motivating example:

  ```sh
  bitcoin-cli -named createwallet wallet_name=mywallet load_on_startup=1
  ```

  Can be shortened to:

  ```sh
  bitcoin-cli -named createwallet mywallet load_on_startup=1
  ```

  JSON-RPC standard doesn't have a convention for passing named and positional parameters together, so this implementation makes one up and interprets any unused `"args"` named parameter as a positional parameter array.

  This change is backwards compatible. It doesn't change the interpretation of any previously valid calls, just treats some previously invalid calls as valid.

  Another use case even if you only occasionally use named arguments is that you can define an alias:

  ```
  alias bcli='bitcoin-cli -named'
  ```

  And now use both named named and unnamed arguments from the same alias without having to manually add `-named` option for named arguments or see annoying error "No '=' in named argument... this needs to be present for every argument (even if it is empty)`" for unnamed arguments

ACKs for top commit:
  achow101:
    ACK d8b12a75db
  stickies-v:
    re-ACK d8b12a75d
  aureleoules:
    re-ACK d8b12a75db

Tree-SHA512: 0cff8b50f584bcbbd376624adccf40536566ed8d1bcd6c88ad565dbc208f19d5e7a48c994efd6329d42b560149340d330397278f08a2912af5f3418d8c8837a9
2022-11-29 18:37:55 -05:00
..
__init__.py Rename rpc-tests directory to functional 2017-03-20 10:40:31 -04:00
address.py test: add helpers for creating P2TR scripts/addresses from output key 2022-06-14 13:32:57 +02:00
authproxy.py rpc: Allow named and positional arguments to be used together 2022-11-05 05:32:39 -04:00
bdb.py scripted-diff: Bump copyright headers 2021-11-10 11:10:24 +01:00
bip340_test_vectors.csv tests: add BIP340 Schnorr signature support to test framework 2020-10-12 17:18:47 -07:00
blockfilter.py test: add compact block filter (BIP158) helper routines 2022-10-20 01:33:17 +02:00
blocktools.py remove unused functions 2022-06-24 18:04:48 +05:30
coverage.py scripted-diff: Bump copyright headers 2021-11-10 11:10:24 +01:00
descriptors.py Output a descriptor in createmultisig and addmultisigaddress 2020-01-30 23:55:36 -05:00
key.py test: Test signing psbts without explicitly having scripts 2022-06-27 16:48:04 -04:00
messages.py test: Add functional tests for sendtxrcncl from inbound 2022-10-17 12:36:13 +03:00
muhash.py test: Change MuHash Python implementation to match cpp version again 2020-12-22 01:48:34 +01:00
netutil.py test: remove import socket in test_ipv6_local 2022-02-14 19:27:33 -03:00
p2p.py Merge bitcoin/bitcoin#26248: net: Set relay in version msg to peers with relay permission in -blocksonly mode 2022-10-21 11:18:48 +02:00
psbt.py tests: Test that PSBT_OUT_TAP_TREE is combined correctly 2022-10-06 15:32:45 -04:00
ripemd160.py Add pure Python RIPEMD-160 2021-12-08 14:29:34 -05:00
script.py Add feature_taproot case involved invalid internal pubkey 2022-11-21 14:00:43 -05:00
script_util.py test: add helpers for creating P2TR scripts/addresses from output key 2022-06-14 13:32:57 +02:00
segwit_addr.py Use Bech32m encoding for v1+ segwit addresses 2021-03-16 10:48:36 -07:00
siphash.py test: add SipHash implementation for generic data in Python 2022-10-20 01:32:48 +02:00
socks5.py scripted-diff: Update copyright in ./test 2019-03-02 10:58:35 -05:00
test_framework.py test: Set default in add_wallet_options if only one type can be chosen 2022-11-15 10:03:56 +01:00
test_node.py Merge bitcoin/bitcoin#19762: rpc: Allow named and positional arguments to be used together 2022-11-29 18:37:55 -05:00
test_shell.py TestShell: Return self from setup() 2019-11-05 12:55:52 +01:00
util.py test: add support for Decimal to assert_approx 2022-08-02 10:11:12 +09:00
wallet.py test: refactor RPCPackagesTest to use MiniWallet 2022-10-03 22:37:40 -03:00
wallet_util.py scripted-diff: Bump copyright headers 2021-11-10 11:10:24 +01:00