Skip to content

Commit 8732326

Browse files
Merge #6649: backport: trivial 2025 04 23
e9f079d Merge bitcoin-core/gui#696: Switch RPCConsole wallet selection to the one most recently opened/restored/created (Hennadii Stepanov) d5f83e3 Merge bitcoin#28919: build: Fix regression in "ARMv8 CRC32 intrinsics" test (fanquake) 2eda4c3 Merge bitcoin#26899: p2p: set `-dnsseed` and `-listen` false if `maxconnections=0` (Andrew Chow) 7b7d9a8 Merge bitcoin#26955: wallet: permit mintxfee=0 (fanquake) 17fee63 Merge bitcoin#26906: test: add an easy way to run linters locally (MarcoFalke) 126907f Merge bitcoin#26791: ci: Properly set COMMIT_RANGE in lint task (MarcoFalke) d9e93f8 Merge bitcoin-core/gui#665: Switch to the selected wallet after loading (Hennadii Stepanov) 311799f Merge bitcoin#26183: build: split ARM crc & crypto extension checks (fanquake) 31dbdac Merge bitcoin#26202: ci: Use remote pull/merge ref instead of local git merge (MacroFake) Pull request description: ## Issue being fixed or feature implemented Batch of trivial backports ## How Has This Been Tested? Built locally ## 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 e9f079d knst: utACK e9f079d Tree-SHA512: 91b96ba948699eb0a09dba9338ce2b73ce32c855d806a625920aa35c38a4e12e0ca04b87d3f7d0a5c090bc042c97c24b117c389b6377e500f25b8a7d2dfe97fc
2 parents e14a8bd + e9f079d commit 8732326

13 files changed

+115
-31
lines changed

.cirrus.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ base_template: &BASE_TEMPLATE
2323
- git config --global user.email "[email protected]"
2424
- git config --global user.name "ci"
2525
- if [ "$CIRRUS_PR" = "" ]; then exit 0; fi
26-
- git fetch $CIRRUS_REPO_CLONE_URL $CIRRUS_BASE_BRANCH
27-
- git merge FETCH_HEAD # Merge base to detect silent merge conflicts
26+
- git fetch $CIRRUS_REPO_CLONE_URL "pull/${CIRRUS_PR}/merge"
27+
- git checkout FETCH_HEAD # Use merged changes to detect silent merge conflicts
28+
# Also, the merge commit is used to lint COMMIT_RANGE="HEAD~..HEAD"
2829

2930
global_task_template: &GLOBAL_TASK_TEMPLATE
3031
<< : *BASE_TEMPLATE

ci/lint/04_install.sh

+21-18
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,25 @@ ${CI_RETRY_EXE} apt-get update
1313
# - gpg (used by verify-commits)
1414
${CI_RETRY_EXE} apt-get install -y curl xz-utils git gpg
1515

16-
PYTHON_PATH=/tmp/python
17-
if [ ! -d "${PYTHON_PATH}/bin" ]; then
18-
(
19-
git clone https://github.com/pyenv/pyenv.git
20-
cd pyenv/plugins/python-build || exit 1
21-
./install.sh
22-
)
23-
# For dependencies see https://github.com/pyenv/pyenv/wiki#suggested-build-environment
24-
${CI_RETRY_EXE} apt-get install -y build-essential libssl-dev zlib1g-dev \
25-
libbz2-dev libreadline-dev libsqlite3-dev curl llvm \
26-
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
27-
clang
28-
env CC=clang python-build "$(cat "${BASE_ROOT_DIR}/.python-version")" "${PYTHON_PATH}"
16+
if [ -z "${SKIP_PYTHON_INSTALL}" ]; then
17+
PYTHON_PATH=/tmp/python
18+
if [ ! -d "${PYTHON_PATH}/bin" ]; then
19+
(
20+
git clone https://github.com/pyenv/pyenv.git
21+
cd pyenv/plugins/python-build || exit 1
22+
./install.sh
23+
)
24+
# For dependencies see https://github.com/pyenv/pyenv/wiki#suggested-build-environment
25+
${CI_RETRY_EXE} apt-get install -y build-essential libssl-dev zlib1g-dev \
26+
libbz2-dev libreadline-dev libsqlite3-dev curl llvm \
27+
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
28+
clang
29+
env CC=clang python-build "$(cat "${BASE_ROOT_DIR}/.python-version")" "${PYTHON_PATH}"
30+
fi
31+
export PATH="${PYTHON_PATH}/bin:${PATH}"
32+
command -v python3
33+
python3 --version
2934
fi
30-
export PATH="${PYTHON_PATH}/bin:${PATH}"
31-
command -v python3
32-
python3 --version
3335

3436
${CI_RETRY_EXE} pip3 install codespell==2.0.0
3537
${CI_RETRY_EXE} pip3 install flake8==3.8.3
@@ -38,5 +40,6 @@ ${CI_RETRY_EXE} pip3 install pyzmq==22.3.0
3840
${CI_RETRY_EXE} pip3 install vulture==2.3
3941

4042
SHELLCHECK_VERSION=v0.8.0
41-
curl -sL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | tar --xz -xf - --directory /tmp/
42-
export PATH="/tmp/shellcheck-${SHELLCHECK_VERSION}:${PATH}"
43+
curl -sL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | \
44+
tar --xz -xf - --directory /tmp/
45+
mv "/tmp/shellcheck-${SHELLCHECK_VERSION}/shellcheck" /usr/bin/

ci/lint/06_script.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66

77
export LC_ALL=C
88

9-
GIT_HEAD=$(git rev-parse HEAD)
10-
if [ -n "$CIRRUS_PR" ]; then
11-
COMMIT_RANGE="${CIRRUS_BASE_SHA}..$GIT_HEAD"
9+
if [ -n "$LOCAL_BRANCH" ]; then
10+
# To faithfully recreate CI linting locally, specify all commits on the current
11+
# branch.
12+
COMMIT_RANGE="$(git merge-base HEAD master)..HEAD"
13+
elif [ -n "$CIRRUS_PR" ]; then
14+
COMMIT_RANGE="HEAD~..HEAD"
1215
echo
1316
git log --no-merges --oneline "$COMMIT_RANGE"
1417
echo

ci/lint/Dockerfile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# See test/lint/README.md for usage.
2+
#
3+
# This container basically has to live in this directory in order to pull in the CI
4+
# install scripts. If it lived in the root directory, it would have to pull in the
5+
# entire repo as docker context during build; if it lived elsewhere, it wouldn't be
6+
# able to make back-references to pull in the install scripts. So here it lives.
7+
8+
FROM python:3.7-buster
9+
10+
ENV DEBIAN_FRONTEND=noninteractive
11+
ENV LC_ALL=C.UTF-8
12+
13+
# This is used by the 04_install.sh script; we can't read the Python version from
14+
# .python-version for the same reasons as above, and it's more efficient to pull a
15+
# preexisting Python image than it is to build from source.
16+
ENV SKIP_PYTHON_INSTALL=1
17+
18+
# Must be built from ./ci/lint/ for these paths to work.
19+
COPY ./docker-entrypoint.sh /entrypoint.sh
20+
COPY ./04_install.sh /install.sh
21+
22+
RUN /install.sh && \
23+
echo 'alias lint="./ci/lint/06_script.sh"' >> ~/.bashrc && \
24+
chmod 755 /entrypoint.sh && \
25+
rm -rf /var/lib/apt/lists/*
26+
27+
28+
WORKDIR /bitcoin
29+
ENTRYPOINT ["/entrypoint.sh"]

ci/lint/docker-entrypoint.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
export LC_ALL=C
3+
4+
# Fixes permission issues when there is a container UID/GID mismatch with the owner
5+
# of the mounted bitcoin src dir.
6+
git config --global --add safe.directory /bitcoin
7+
8+
if [ -z "$1" ]; then
9+
LOCAL_BRANCH=1 bash -ic "./ci/lint/06_script.sh"
10+
else
11+
exec "$@"
12+
fi

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ CXXFLAGS="$TEMP_CXXFLAGS"
634634

635635
# ARM
636636
AX_CHECK_COMPILE_FLAG([-march=armv8-a+crc+crypto], [ARM_CRC_CXXFLAGS="-march=armv8-a+crc+crypto"], [], [$CXXFLAG_WERROR])
637-
AX_CHECK_COMPILE_FLAG([-march=armv8-a+crc+crypto], [ARM_SHANI_CXXFLAGS="-march=armv8-a+crc+crypto"], [], [$CXXFLAG_WERROR])
637+
AX_CHECK_COMPILE_FLAG([-march=armv8-a+crypto], [ARM_SHANI_CXXFLAGS="-march=armv8-a+crypto"], [], [$CXXFLAG_WERROR])
638638

639639
TEMP_CXXFLAGS="$CXXFLAGS"
640640
CXXFLAGS="$CXXFLAGS $ARM_CRC_CXXFLAGS"

doc/release-notes-6649.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Updated settings
2+
----------------
3+
4+
- Setting `-maxconnections=0` will now disable `-dnsseed`
5+
and `-listen` (users may still set them to override) (#6649).

src/init.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -556,11 +556,11 @@ void SetupServerArgs(ArgsManager& argsman)
556556
argsman.AddArg("-connect=<ip>", "Connect only to the specified node; -noconnect disables automatic connections (the rules for this peer are the same as for -addnode). This option can be specified multiple times to connect to multiple nodes.", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::CONNECTION);
557557
argsman.AddArg("-discover", "Discover own IP addresses (default: 1 when listening and no -externalip or -proxy)", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
558558
argsman.AddArg("-dns", strprintf("Allow DNS lookups for -addnode, -seednode and -connect (default: %u)", DEFAULT_NAME_LOOKUP), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
559-
argsman.AddArg("-dnsseed", strprintf("Query for peer addresses via DNS lookup, if low on addresses (default: %u unless -connect used)", DEFAULT_DNSSEED), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
559+
argsman.AddArg("-dnsseed", strprintf("Query for peer addresses via DNS lookup, if low on addresses (default: %u unless -connect used or -maxconnections=0)", DEFAULT_DNSSEED), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
560560
argsman.AddArg("-externalip=<ip>", "Specify your own public address", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
561561
argsman.AddArg("-fixedseeds", strprintf("Allow fixed seeds if DNS seeds don't provide peers (default: %u)", DEFAULT_FIXEDSEEDS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
562562
argsman.AddArg("-forcednsseed", strprintf("Always query for peer addresses via DNS lookup (default: %u)", DEFAULT_FORCEDNSSEED), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
563-
argsman.AddArg("-listen", strprintf("Accept connections from outside (default: %u if no -proxy or -connect)", DEFAULT_LISTEN), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
563+
argsman.AddArg("-listen", strprintf("Accept connections from outside (default: %u if no -proxy, -connect or -maxconnections=0)", DEFAULT_LISTEN), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
564564
argsman.AddArg("-listenonion", strprintf("Automatically create Tor onion service (default: %d)", DEFAULT_LISTEN_ONION), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
565565
argsman.AddArg("-maxconnections=<n>", strprintf("Maintain at most <n> connections to peers (temporary service connections excluded) (default: %u). This limit does not apply to connections manually added via -addnode or the addnode RPC, which have a separate limit of %u.", DEFAULT_MAX_PEER_CONNECTIONS, MAX_ADDNODE_CONNECTIONS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
566566
argsman.AddArg("-maxreceivebuffer=<n>", strprintf("Maximum per-connection receive buffer, <n>*1000 bytes (default: %u)", DEFAULT_MAXRECEIVEBUFFER), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
@@ -917,12 +917,12 @@ void InitParameterInteraction(ArgsManager& args)
917917
LogPrintf("%s: parameter interaction: -whitebind set -> setting -listen=1\n", __func__);
918918
}
919919

920-
if (args.IsArgSet("-connect")) {
920+
if (args.IsArgSet("-connect") || args.GetIntArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS) <= 0) {
921921
// when only connecting to trusted nodes, do not seed via DNS, or listen by default
922922
if (args.SoftSetBoolArg("-dnsseed", false))
923-
LogPrintf("%s: parameter interaction: -connect set -> setting -dnsseed=0\n", __func__);
923+
LogPrintf("%s: parameter interaction: -connect or -maxconnections=0 set -> setting -dnsseed=0\n", __func__);
924924
if (args.SoftSetBoolArg("-listen", false))
925-
LogPrintf("%s: parameter interaction: -connect set -> setting -listen=0\n", __func__);
925+
LogPrintf("%s: parameter interaction: -connect or -maxconnections=0 set -> setting -listen=0\n", __func__);
926926
}
927927

928928
std::string proxy_arg = args.GetArg("-proxy", "");

src/qt/bitcoingui.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,8 @@ void BitcoinGUI::createActions()
536536

537537
connect(action, &QAction::triggered, [this, path] {
538538
auto activity = new OpenWalletActivity(m_wallet_controller, this);
539-
connect(activity, &OpenWalletActivity::opened, this, &BitcoinGUI::setCurrentWallet);
539+
connect(activity, &OpenWalletActivity::opened, this, &BitcoinGUI::setCurrentWallet, Qt::QueuedConnection);
540+
connect(activity, &OpenWalletActivity::opened, rpcConsole, &RPCConsole::setCurrentWallet, Qt::QueuedConnection);
540541
activity->open(path);
541542
});
542543
}
@@ -566,6 +567,7 @@ void BitcoinGUI::createActions()
566567

567568
auto activity = new RestoreWalletActivity(m_wallet_controller, this);
568569
connect(activity, &RestoreWalletActivity::restored, this, &BitcoinGUI::setCurrentWallet, Qt::QueuedConnection);
570+
connect(activity, &RestoreWalletActivity::restored, rpcConsole, &RPCConsole::setCurrentWallet, Qt::QueuedConnection);
569571

570572
auto backup_file_path = fs::PathFromString(backup_file.toStdString());
571573
activity->restore(backup_file_path, wallet_name.toStdString());
@@ -576,6 +578,7 @@ void BitcoinGUI::createActions()
576578
connect(m_create_wallet_action, &QAction::triggered, [this] {
577579
auto activity = new CreateWalletActivity(m_wallet_controller, this);
578580
connect(activity, &CreateWalletActivity::created, this, &BitcoinGUI::setCurrentWallet);
581+
connect(activity, &CreateWalletActivity::created, rpcConsole, &RPCConsole::setCurrentWallet);
579582
activity->create();
580583
});
581584
connect(m_close_all_wallets_action, &QAction::triggered, [this] {

src/qt/rpcconsole.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,12 @@ void RPCConsole::removeWallet(WalletModel * const walletModel)
863863
ui->wallet_path->clear();
864864
}
865865
}
866+
867+
void RPCConsole::setCurrentWallet(WalletModel* const wallet_model)
868+
{
869+
QVariant data = QVariant::fromValue(wallet_model);
870+
ui->WalletSelector->setCurrentIndex(ui->WalletSelector->findData(data));
871+
}
866872
#endif
867873

868874
static QString categoryClass(int category)

src/qt/rpcconsole.h

+4
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ public Q_SLOTS:
143143
void unbanSelectedNode();
144144
/** set which tab has the focus (is visible) */
145145
void setTabFocus(enum TabTypes tabType);
146+
#ifdef ENABLE_WALLET
147+
/** Set the current (ie - active) wallet */
148+
void setCurrentWallet(WalletModel* const wallet_model);
149+
#endif // ENABLE_WALLET
146150

147151
Q_SIGNALS:
148152
// For RPC command executor

src/wallet/wallet.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2867,7 +2867,7 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
28672867

28682868
if (args.IsArgSet("-mintxfee")) {
28692869
std::optional<CAmount> min_tx_fee = ParseMoney(args.GetArg("-mintxfee", ""));
2870-
if (!min_tx_fee || min_tx_fee.value() == 0) {
2870+
if (!min_tx_fee) {
28712871
error = AmountErrMsg("mintxfee", args.GetArg("-mintxfee", ""));
28722872
return nullptr;
28732873
} else if (min_tx_fee.value() > HIGH_TX_FEE_PER_KB) {

test/lint/README.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
This folder contains lint scripts.
22

3+
Running locally
4+
===============
5+
6+
To run linters locally with the same versions as the CI environment, use the included
7+
Dockerfile:
8+
9+
```sh
10+
cd ./ci/lint
11+
docker build -t bitcoin-linter .
12+
13+
cd /root/of/bitcoin/repo
14+
docker run --rm -v $(pwd):/bitcoin -it bitcoin-linter
15+
```
16+
17+
After building the container once, you can simply run the last command any time you
18+
want to lint.
19+
20+
321
check-doc.py
422
============
523
Check for missing documentation of command line options.

0 commit comments

Comments
 (0)