elements/src/rpc
MarcoFalke a4baf3f177
Merge bitcoin/bitcoin#26628: RPC: Reject RPC requests with same named parameter specified multiple times
8c3ff7d52a test: Suggested cleanups for rpc_namedparams test (Ryan Ofsky)
d1ca563825 bitcoin-cli: Make it an error to specify the "args" parameter two different ways (Ryan Ofsky)
6bd1d20b8c rpc: Make it an error server-side to specify same named parameter multiple times (Ryan Ofsky)
e2c3b18e67 test: Add RPC tests for same named parameter specified more than once (Ryan Ofsky)

Pull request description:

  Make the JSON-RPC server reject requests with the same named parameter specified multiple times, instead of silently overwriting earlier parameter values with later ones.

  Generally JSON keys are supposed to unique, and their order isn't supposed to be significant, so having the server silently discard duplicate keys is error-prone. Most likely if an RPC client is sending a request with duplicate keys it means something is wrong with the request and there should be an error.

  After this change, named parameters are still allowed to specified multiple times on the `bitcoin-cli` command line, since `bitcoin-cli` automatically replaces earlier values with later values before sending the JSON-RPC request. This makes sense, since it's not unusual for the order of command line options to be significant or for later command line options to override earlier ones.

ACKs for top commit:
  MarcoFalke:
    review ACK 8c3ff7d52a 🗂
  kristapsk:
    ACK 8c3ff7d52a
  stickies-v:
    ACK 8c3ff7d52

Tree-SHA512: 2d1357dcc2c171da287aeefc7b333ba4e67babfb64fc14d7fa0940256e18010a2a65054f3bf7fa1571b144d2de8b82d53076111b5f97ba29320cfe84b6ed986f
2022-12-13 17:57:23 +01:00
..
blockchain.cpp rpc: reduce LOCK(cs_main) scope in GetUndoChecked and getblockstats 2022-12-06 15:07:04 -05:00
blockchain.h scripted-diff: rename CChainState -> Chainstate 2022-09-09 11:47:27 -04:00
client.cpp bitcoin-cli: Make it an error to specify the "args" parameter two different ways 2022-12-02 17:53:58 -05:00
client.h Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
external_signer.cpp Remove not needed clang-format off comments 2022-04-25 10:55:07 +02:00
fees.cpp rpc: remove unneeded RPCTypeCheckArgument checks 2022-09-15 10:45:18 -03:00
mempool.cpp refactor: Move txmempool_entry.h --> kernel/mempool_entry.h 2022-11-30 10:37:57 +00:00
mempool.h rpc: Move mempool RPCs to new file 2022-03-11 17:46:58 +01:00
mining.cpp Merge bitcoin/bitcoin#26118: log: Use steady clock for bench logging 2022-10-10 12:00:34 +02:00
mining.h rpc: create rpc/mining.h, hoist default max tries values to constant 2020-06-01 15:08:36 +02:00
net.cpp bugfix: Strict type checking for RPC boolean parameters 2022-12-07 17:55:58 +01:00
node.cpp scripted-diff: Replace NullUniValue with UniValue::VNULL 2022-07-25 17:27:53 +02:00
output_script.cpp doc: add tr() descriptor example to deriveaddresses 2022-11-23 10:17:29 -05:00
protocol.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
rawtransaction.cpp refactor: Replace isTrue with get_bool 2022-12-07 17:56:49 +01:00
rawtransaction_util.cpp Merge bitcoin/bitcoin#25707: refactor: Make const references to avoid unnecessarily copying objects and enable two clang-tidy checks 2022-08-19 17:11:06 +02:00
rawtransaction_util.h rpc: Default rbf enabled 2022-07-15 11:46:34 -04:00
register.h scripted-diff: Rename rpc/misc.cpp to rpc/node.cpp 2022-05-03 09:05:15 +02:00
request.cpp Merge bitcoin/bitcoin#24675: util: Use ArgsManager::GetPathArg more widely 2022-08-04 16:58:01 +01:00
request.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
server.cpp Merge bitcoin/bitcoin#26628: RPC: Reject RPC requests with same named parameter specified multiple times 2022-12-13 17:57:23 +01:00
server.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
server_util.cpp Add src/node/* code to node:: namespace 2022-01-06 22:14:16 -05:00
server_util.h Add src/node/* code to node:: namespace 2022-01-06 22:14:16 -05:00
signmessage.cpp rpc: Move signmessage RPC util to new file 2022-04-28 11:19:29 +02:00
txoutproof.cpp rpc: reduce LOCK(cs_main) scope in gettxoutproof 2022-12-06 15:07:04 -05:00
util.cpp Adjust RPCTypeCheckObj error string 2022-10-10 18:08:00 -03:00
util.h rpc: Set RPCArg options with designated initializers 2022-09-13 18:37:15 +02:00