Skip to content

Commit 0254959

Browse files
Merge dashpay#6050: backport: trivial 2024 06 07
6777ab7 Merge bitcoin-core/gui#682: Don't directly delete abandoned txes from GUI (Hennadii Stepanov) 6e1a8c1 Merge bitcoin#26628: RPC: Reject RPC requests with same named parameter specified multiple times (MarcoFalke) 7c28b01 Merge bitcoin#26666: refactor: Deleted unreachable code in httpserver.cpp (MarcoFalke) 478fe51 Merge bitcoin#26100: doc: clarify that NetPermissionFlags::Implicit is only about whitelists (MarcoFalke) 69b19cb Merge bitcoin#26546: test: remove unused class `NodePongAdd1` (fanquake) 245df94 Merge bitcoin#26380: Revert "test: check importing wallets when blocks are pruned throw an error" (MacroFake) 3db3bd0 Merge bitcoin#24269: test: add functional test for `-discover` (Andrew Chow) c72ef29 Merge bitcoin#25896: wallet: Log when Wallet::SetMinVersion sets a different minversion (Andrew Chow) 12b438c Merge bitcoin#25925: doc: add `{import,list}descriptors` to list of descriptor RPCs (Andrew Chow) 73d64c4 Merge bitcoin#25738: depends: use a patch instead of sed in libxcb (fanquake) 1fae0c2 Merge bitcoin#25333: test: Fix out-of-range port collisions (MacroFake) b750896 Merge bitcoin#25231: ci: Install documented packages for "Win64" CI task (fanquake) Pull request description: ## Issue being fixed or feature implemented Batch of trivial backports ## What was done? Trivial backports ## How Has This Been Tested? Built; ran tests locally ## Breaking Changes None ## Checklist: _Go over all the following points, and put an `x` in all the boxes that apply._ - [ ] 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 - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 6777ab7 Tree-SHA512: 60d68c8d0fb9875d0b2421cad97b46a9d4deb79e03ca011d66cc0595ed68bb7ad207f2fd95973a3b7a0b9bca2c2f0deaf0e1116f0312a4d9d315f009228fe485
2 parents 21af5af + 6777ab7 commit 0254959

20 files changed

+139
-52
lines changed

ci/test/00_setup_env_win64.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export LC_ALL=C.UTF-8
99
export CONTAINER_NAME=ci_win64
1010
export HOST=x86_64-w64-mingw32
1111
export DPKG_ADD_ARCH="i386"
12-
export PACKAGES="python3 nsis g++-mingw-w64-x86-64 wine-binfmt wine64 wine32 file"
12+
export PACKAGES="python3 nsis g++-mingw-w64-x86-64-posix wine-binfmt wine64 wine32 file"
1313
export RUN_FUNCTIONAL_TESTS=false
1414
export RUN_SECURITY_TESTS="false"
1515
export GOAL="deploy"

depends/packages/libxcb.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ $(package)_download_path=https://xcb.freedesktop.org/dist
44
$(package)_file_name=$(package)-$($(package)_version).tar.xz
55
$(package)_sha256_hash=a55ed6db98d43469801262d81dc2572ed124edc3db31059d4e9916eb9f844c34
66
$(package)_dependencies=xcb_proto libXau
7+
$(package)_patches = remove_pthread_stubs.patch
78

89
define $(package)_set_vars
910
$(package)_config_opts=--disable-static --disable-devel-docs --without-doxygen --without-launchd
@@ -20,7 +21,7 @@ endef
2021

2122
define $(package)_preprocess_cmds
2223
cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub build-aux && \
23-
sed "s/pthread-stubs//" -i configure
24+
patch -p1 -i $($(package)_patch_dir)/remove_pthread_stubs.patch
2425
endef
2526

2627
define $(package)_config_cmds
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Remove uneeded pthread-stubs dependency
2+
--- a/configure
3+
+++ b/configure
4+
@@ -19695,7 +19695,7 @@ fi
5+
NEEDED="xau >= 0.99.2"
6+
case $host_os in
7+
linux*) ;;
8+
- *) NEEDED="$NEEDED pthread-stubs" ;;
9+
+ *) NEEDED="$NEEDED" ;;
10+
esac
11+
12+
pkg_failed=no

doc/descriptors.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ Supporting RPCs are:
1111
addresses.
1212
- `listunspent` outputs a specialized descriptor for the reported unspent outputs.
1313
- `getaddressinfo` outputs a descriptor for solvable addresses (since v0.18).
14-
- `importmulti` takes as input descriptors to import into the wallet
14+
- `importmulti` takes as input descriptors to import into a legacy wallet
1515
(since v0.18).
1616
- `generatetodescriptor` takes as input a descriptor and generates coins to it
1717
(`regtest` only, since v0.19).
1818
- `utxoupdatepsbt` takes as input descriptors to add information to the psbt
1919
(since v0.19).
20-
- `createmultisig` and `addmultisigaddress` return descriptors as well (since v0.20)
20+
- `createmultisig` and `addmultisigaddress` return descriptors as well (since v0.20).
21+
- `importdescriptors` takes as input descriptors to import into a descriptor wallet
22+
(since v0.21).
23+
- `listdescriptors` outputs descriptors imported into a descriptor wallet (since v22).
2124

2225
This document describes the language. For the specifics on usage, see the RPC
2326
documentation for the functions mentioned above.

doc/release-notes-6050.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
JSON-RPC
2+
---
3+
4+
The JSON-RPC server now rejects requests where a parameter is specified multiple times with the same name, instead of silently overwriting earlier parameter values with later ones. (dash#6050)

src/httpserver.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -190,19 +190,16 @@ std::string RequestMethodString(HTTPRequest::RequestMethod m)
190190
switch (m) {
191191
case HTTPRequest::GET:
192192
return "GET";
193-
break;
194193
case HTTPRequest::POST:
195194
return "POST";
196-
break;
197195
case HTTPRequest::HEAD:
198196
return "HEAD";
199-
break;
200197
case HTTPRequest::PUT:
201198
return "PUT";
202-
break;
203-
default:
199+
case HTTPRequest::UNKNOWN:
204200
return "unknown";
205-
}
201+
} // no default case, so the compiler can warn about missing cases
202+
assert(false);
206203
}
207204

208205
/** HTTP request callback */
@@ -623,19 +620,14 @@ HTTPRequest::RequestMethod HTTPRequest::GetRequestMethod() const
623620
switch (evhttp_request_get_command(req)) {
624621
case EVHTTP_REQ_GET:
625622
return GET;
626-
break;
627623
case EVHTTP_REQ_POST:
628624
return POST;
629-
break;
630625
case EVHTTP_REQ_HEAD:
631626
return HEAD;
632-
break;
633627
case EVHTTP_REQ_PUT:
634628
return PUT;
635-
break;
636629
default:
637630
return UNKNOWN;
638-
break;
639631
}
640632
}
641633

src/net_permissions.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ enum class NetPermissionFlags : uint32_t {
3434
// unlimited amounts of addrs.
3535
Addr = (1U << 7),
3636

37-
// True if the user did not specifically set fine grained permissions
37+
// True if the user did not specifically set fine-grained permissions with
38+
// the -whitebind or -whitelist configuration options.
3839
Implicit = (1U << 31),
3940
All = BloomFilter | ForceRelay | Relay | NoBan | Mempool | Download | Addr,
4041
};

src/qt/transactionview.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,6 @@ void TransactionView::abandonTx()
453453

454454
// Abandon the wallet transaction over the walletModel
455455
model->wallet().abandonTransaction(hash);
456-
457-
// Update the table
458-
model->getTransactionTableModel()->updateTransaction(hashQStr, CT_UPDATED, false);
459456
}
460457

461458
void TransactionView::resendTx()

src/rpc/client.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ UniValue RPCConvertNamedValues(const std::string &strMethod, const std::vector<s
305305
std::string name = s.substr(0, pos);
306306
std::string value = s.substr(pos+1);
307307

308+
// Intentionally overwrite earlier named values with later ones as a
309+
// convenience for scripts and command line users that want to merge
310+
// options.
308311
if (!rpcCvtTable.convert(strMethod, name)) {
309312
// insert string value directly
310313
params.pushKV(name, value);
@@ -315,7 +318,10 @@ UniValue RPCConvertNamedValues(const std::string &strMethod, const std::vector<s
315318
}
316319

317320
if (!positional_args.empty()) {
318-
params.pushKV("args", positional_args);
321+
// Use __pushKV instead of pushKV to avoid overwriting an explicit
322+
// "args" value with an implicit one. Let the RPC server handle the
323+
// request as given.
324+
params.__pushKV("args", positional_args);
319325
}
320326

321327
return params;

src/rpc/server.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,10 @@ static inline JSONRPCRequest transformNamedArguments(const JSONRPCRequest& in, c
436436
const std::vector<UniValue>& values = in.params.getValues();
437437
std::unordered_map<std::string, const UniValue*> argsIn;
438438
for (size_t i=0; i<keys.size(); ++i) {
439-
argsIn[keys[i]] = &values[i];
439+
auto [_, inserted] = argsIn.emplace(keys[i], &values[i]);
440+
if (!inserted) {
441+
throw JSONRPCError(RPC_INVALID_PARAMETER, "Parameter " + keys[i] + " specified multiple times");
442+
}
440443
}
441444
// Process expected parameters. If any parameters were left unspecified in
442445
// the request before a parameter that was specified, null values need to be

0 commit comments

Comments
 (0)