From 688b66e9d196a87002baecdcbcd277e16962757a Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 2 Apr 2021 09:34:56 +0200 Subject: [PATCH 1/7] Merge bitcoin-core/gui#266: Doc: Copyright: Fix embedded font file location e309646db6563926f05627814f01d7d89b3d2d6f Doc: Copyright: Fix embedded font file location (wodry) Pull request description: ACKs for top commit: hebasto: ACK e309646db6563926f05627814f01d7d89b3d2d6f, it was overlooked in https://github.com/bitcoin-core/gui/pull/79/commits/89e421918ee8b9c8439317f747e5c37f0733d94b. Tree-SHA512: 016035b82b587fd195a53bcea938b2d1258b8e908ac545477e2002d713c063b3f18f01cd546aaac3ce0543aec029502fcde3b552ab3e837125a1c0f8a983996a --- contrib/debian/copyright | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/debian/copyright b/contrib/debian/copyright index 2f9c7ced90..87742b02a8 100644 --- a/contrib/debian/copyright +++ b/contrib/debian/copyright @@ -31,7 +31,7 @@ Files: src/qt/res/icons/proxy.png Copyright: Cristian Mircea Messel License: public-domain -Files: src/qt/fonts/RobotoMono-Bold.ttf +Files: src/qt/res/fonts/RobotoMono-Bold.ttf License: Apache-2.0 Comment: Site: https://fonts.google.com/specimen/Roboto+Mono From 8e0abeb1c15c46526eda448f469ca60aea466a59 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Wed, 29 Sep 2021 11:52:38 +0300 Subject: [PATCH 2/7] Merge bitcoin-core/gui#345: Connection Type Translator Comments 4832737c7dcc87afea5e1e88945ec311417aa876 qt: connection type translator comments (Jarol Rodriguez) Pull request description: This PR introduces Qt translator comments for `Connection Type` strings in `guiutil.cpp` as well as `rpcconsole.cpp`. This is an alternate implementation of the idea presented in the last three commits of #289. It is especially inspired by commit 842f4e834dfe5fd2786a5092f78ea28da1b36e4f. Per [Qt Dev Notes](https://github.com/bitcoin-core/bitcoin-devwiki/wiki/Developer-Notes-for-Qt-Code), it is better to not break up strings when not necessary. This way we preserve the full context for translators. ACKs for top commit: jonatack: Code review re-ACK 4832737c7dcc87afea5e1e88945ec311417aa876 per `git diff 371e2b9 4832737`, changes are translator comment edits since my review yesterday (thank you for updating) hebasto: ACK 4832737c7dcc87afea5e1e88945ec311417aa876 Tree-SHA512: 67e1741e10a2e30cde6d50d3293eec89f0b7641b34463865dc6909d2926cdcf33a7d8c1dc8055d2f85906ad2002cdaa594d37b184d16e2f06614b6c5ad00c982 --- src/qt/guiutil.cpp | 14 +++++++++++++- src/qt/rpcconsole.cpp | 14 ++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index d7c412ce78..f42aadd981 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -1673,14 +1673,26 @@ QString ConnectionTypeToQString(ConnectionType conn_type, bool prepend_direction { QString prefix; if (prepend_direction) { - prefix = (conn_type == ConnectionType::INBOUND) ? QObject::tr("Inbound") : QObject::tr("Outbound") + " "; + prefix = (conn_type == ConnectionType::INBOUND) ? + /*: An inbound connection from a peer. An inbound connection + is a connection initiated by a peer. */ + QObject::tr("Inbound") : + /*: An outbound connection to a peer. An outbound connection + is a connection initiated by us. */ + QObject::tr("Outbound") + " "; } switch (conn_type) { case ConnectionType::INBOUND: return prefix; + //: Peer connection type that relays all network information. case ConnectionType::OUTBOUND_FULL_RELAY: return prefix + QObject::tr("Full Relay"); + /*: Peer connection type that relays network information about + blocks and not transactions or addresses. */ case ConnectionType::BLOCK_RELAY: return prefix + QObject::tr("Block Relay"); + //: Peer connection type established manually through one of several methods. case ConnectionType::MANUAL: return prefix + QObject::tr("Manual"); + //: Short-lived peer connection type that tests the aliveness of known addresses. case ConnectionType::FEELER: return prefix + QObject::tr("Feeler"); + //: Short-lived peer connection type that solicits known addresses from a peer. case ConnectionType::ADDR_FETCH: return prefix + QObject::tr("Address Fetch"); } // no default case, so the compiler can warn about missing cases assert(false); diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 1ac3af2c00..e3e954ed71 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -503,14 +503,28 @@ RPCConsole::RPCConsole(interfaces::Node& node, QWidget* parent, Qt::WindowFlags constexpr QChar nonbreaking_hyphen(8209); const std::vector CONNECTION_TYPE_DOC{ + //: Explanatory text for an inbound peer connection. tr("Inbound: initiated by peer"), + /*: Explanatory text for an outbound peer connection that + relays all network information. This is the default behavior for + outbound connections. */ tr("Outbound Full Relay: default"), + /*: Explanatory text for an outbound peer connection that relays + network information about blocks and not transactions or addresses. */ tr("Outbound Block Relay: does not relay transactions or addresses"), + /*: Explanatory text for an outbound peer connection that was + established manually through one of several methods. The numbered + arguments are stand-ins for the methods available to establish + manual connections. */ tr("Outbound Manual: added using RPC %1 or %2/%3 configuration options") .arg("addnode") .arg(QString(nonbreaking_hyphen) + "addnode") .arg(QString(nonbreaking_hyphen) + "connect"), + /*: Explanatory text for a short-lived outbound peer connection that + is used to test the aliveness of known addresses. */ tr("Outbound Feeler: short-lived, for testing addresses"), + /*: Explanatory text for a short-lived outbound peer connection that is used + to request addresses from a peer. */ tr("Outbound Address Fetch: short-lived, for soliciting addresses")}; const QString list{""}; ui->peerConnectionTypeLabel->setToolTip(ui->peerConnectionTypeLabel->toolTip().arg(list)); From c67f527b0bfdd07b6c2b3c03fc29cfe2911d8065 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Sat, 9 Oct 2021 13:36:59 +0300 Subject: [PATCH 3/7] Merge bitcoin-core/gui#448: Add helper to load font MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit d54ec27bac388d7b84cf7b6cb4506bb0c25f2f88 qt: Add helper to load font (João Barbosa) Pull request description: Originally submitted as https://github.com/bitcoin-core/gui-qml/pull/49. ACKs for top commit: hebasto: re-ACK d54ec27bac388d7b84cf7b6cb4506bb0c25f2f88 stratospher: Tested ACK d54ec27. Refactoring the code and defining `loadFont()` in `src/qt/guiutil.cpp` reduces redundant imports of the `QFontDatabase` and is a better design. shaavan: ACK d54ec27bac388d7b84cf7b6cb4506bb0c25f2f88 Tree-SHA512: b156bb6ffb08dd57476f383a29bbb0a1108b62794d430debb77252f7d09df1409a7532b09d17d8836d1c2ab7c126a6618231164b9d0def1b8f361a81ef22d107 --- src/qt/bitcoin.cpp | 3 +-- src/qt/guiutil.cpp | 6 ++++++ src/qt/guiutil.h | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 1196a37dd7..d6b5dbd280 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -47,7 +47,6 @@ #include #include -#include #include #include #include @@ -577,7 +576,7 @@ int GuiMain(int argc, char* argv[]) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); BitcoinApplication app; - QFontDatabase::addApplicationFont(":/fonts/monospace"); + GUIUtil::LoadFont(QStringLiteral(":/fonts/monospace")); /// 2. Parse command-line options. We do this after qt in order to show an error if there are problems parsing these // Command-line options take precedence: diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index f42aadd981..14761903cf 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -493,6 +493,12 @@ bool hasEntryData(const QAbstractItemView *view, int column, int role) return !selection.at(0).data(role).toString().isEmpty(); } +void LoadFont(const QString& file_name) +{ + const int id = QFontDatabase::addApplicationFont(file_name); + assert(id != -1); +} + QString getDefaultDataDirectory() { return PathToQString(GetDefaultDataDir()); diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index 710525a4c8..07606cea0d 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -172,6 +172,11 @@ namespace GUIUtil void setClipboard(const QString& str); + /** + * Loads the font from the file specified by file_name, aborts if it fails. + */ + void LoadFont(const QString& file_name); + /** * Determine default data directory for operating system. */ From 012b0b71691b7619fb6b79984b00b3ab5afd1ab7 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 28 Mar 2022 09:00:05 +0200 Subject: [PATCH 4/7] Merge bitcoin/bitcoin#24258: test: check localaddresses in getnetworkinfo for nodes with proxy 89bb25d22a0e1c700dba4e3b754984c9b2b14836 test: check localaddresses in getnetworkinfo for nodes with proxy (brunoerg) Pull request description: This PR adds test coverage for the field `localaddresses` for `getnetworkinfo`. In this case, it verifies if this field is empty for all nodes since they are using proxy. Reference: https://github.com/bitcoin/bitcoin/blob/515200298b555845696a07ae2bc0a84a5dd02ae4/src/init.cpp#L449 ACKs for top commit: jonatack: ACK 89bb25d22a0e1c700dba4e3b754984c9b2b14836 Tree-SHA512: 3c765c7060b6972c1ae5a1104734cd7669b650b5f6aa4f623f4299567732260da5083fef306a7c1e71c931f5d1396f24abad251d95c3d82b1f3ee0efee7fcd1f --- test/functional/feature_proxy.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/test/functional/feature_proxy.py b/test/functional/feature_proxy.py index 92992cbc3d..7e735c4252 100755 --- a/test/functional/feature_proxy.py +++ b/test/functional/feature_proxy.py @@ -237,7 +237,15 @@ class ProxyTest(BitcoinTestFramework): return r self.log.info("Test RPC getnetworkinfo") - n0 = networks_dict(self.nodes[0].getnetworkinfo()) + nodes_network_info = [] + + self.log.debug("Test that setting -proxy disables local address discovery, i.e. -discover=0") + for node in self.nodes: + network_info = node.getnetworkinfo() + assert_equal(network_info["localaddresses"], []) + nodes_network_info.append(network_info) + + n0 = networks_dict(nodes_network_info[0]) assert_equal(NETWORKS, n0.keys()) for net in NETWORKS: if net == NET_I2P: @@ -252,7 +260,7 @@ class ProxyTest(BitcoinTestFramework): assert_equal(n0['i2p']['reachable'], False) assert_equal(n0['cjdns']['reachable'], False) - n1 = networks_dict(self.nodes[1].getnetworkinfo()) + n1 = networks_dict(nodes_network_info[1]) assert_equal(NETWORKS, n1.keys()) for net in ['ipv4', 'ipv6']: assert_equal(n1[net]['proxy'], f'{self.conf1.addr[0]}:{self.conf1.addr[1]}') @@ -264,7 +272,7 @@ class ProxyTest(BitcoinTestFramework): assert_equal(n1['i2p']['proxy_randomize_credentials'], False) assert_equal(n1['i2p']['reachable'], True) - n2 = networks_dict(self.nodes[2].getnetworkinfo()) + n2 = networks_dict(nodes_network_info[2]) assert_equal(NETWORKS, n2.keys()) proxy = f'{self.conf2.addr[0]}:{self.conf2.addr[1]}' for net in NETWORKS: @@ -281,7 +289,7 @@ class ProxyTest(BitcoinTestFramework): assert_equal(n2['cjdns']['reachable'], False) if self.have_ipv6: - n3 = networks_dict(self.nodes[3].getnetworkinfo()) + n3 = networks_dict(nodes_network_info[3]) assert_equal(NETWORKS, n3.keys()) proxy = f'[{self.conf3.addr[0]}]:{self.conf3.addr[1]}' for net in NETWORKS: @@ -292,7 +300,7 @@ class ProxyTest(BitcoinTestFramework): assert_equal(n3['i2p']['reachable'], False) assert_equal(n3['cjdns']['reachable'], False) - n4 = networks_dict(self.nodes[4].getnetworkinfo()) + n4 = networks_dict(nodes_network_info[4]) assert_equal(NETWORKS, n4.keys()) for net in NETWORKS: if net == NET_I2P: From 6bf786d168dfa05fc787da77478421b9781484d6 Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 3 Oct 2022 18:06:38 +0100 Subject: [PATCH 5/7] Merge bitcoin/bitcoin#25735: net: remove useless call to IsReachable() from CConnman::Bind() 9cbfe40d8af8567682284890c080b0c3cf434490 net: remove useless call to IsReachable() from CConnman::Bind() (Vasil Dimov) Pull request description: `CConnman::Bind()` is called without `BF_EXPLICIT` only when passed either `0.0.0.0` or `::`. For those addresses `IsReachable()` is always true (regardless of the `-onlynet=` setting!), meaning that the `if` condition never evaluates to true. `IsReachable()` is always true for the "any" IPv4 and IPv6 addresses because `CNetAddr::GetNetwork()` returns `NET_UNROUTABLE` instead of `NET_IPV4` or `NET_IPV6` and the network `NET_UNROUTABLE` is always considered reachable. It follows that `BF_EXPLICIT` is unnecessary, remove it too. ACKs for top commit: naumenkogs: ACK 9cbfe40d8af8567682284890c080b0c3cf434490 aureleoules: ACK 9cbfe40d8af8567682284890c080b0c3cf434490 mzumsande: ACK 9cbfe40d8af8567682284890c080b0c3cf434490 Tree-SHA512: 4e53ee8a73ddd133fd4ff25635135b65e5c19d1fc56fe5c30337406560664616c0adff414dca47602948919f34c81073aae6bfc2871509f3912663d86750928e --- src/net.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index e82d132060..6f8c35bf77 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -105,13 +105,12 @@ static constexpr auto FEELER_SLEEP_WINDOW{1s}; /** Used to pass flags to the Bind() function */ enum BindFlags { BF_NONE = 0, - BF_EXPLICIT = (1U << 0), - BF_REPORT_ERROR = (1U << 1), + BF_REPORT_ERROR = (1U << 0), /** * Do not call AddLocal() for our special addresses, e.g., for incoming * Tor connections, to prevent gossiping them over the network. */ - BF_DONT_ADVERTISE = (1U << 2), + BF_DONT_ADVERTISE = (1U << 1), }; #ifndef USE_WAKEUP_PIPE @@ -3329,9 +3328,6 @@ bool CConnman::Bind(const CService& addr_, unsigned int flags, NetPermissionFlag { const CService addr{MaybeFlipIPv6toCJDNS(addr_)}; - if (!(flags & BF_EXPLICIT) && !IsReachable(addr)) { - return false; - } bilingual_str strError; if (!BindListenPort(addr, strError, permissions)) { if ((flags & BF_REPORT_ERROR) && clientInterface) { @@ -3351,13 +3347,13 @@ bool CConnman::InitBinds(const Options& options) { bool fBound = false; for (const auto& addrBind : options.vBinds) { - fBound |= Bind(addrBind, (BF_EXPLICIT | BF_REPORT_ERROR), NetPermissionFlags::None); + fBound |= Bind(addrBind, BF_REPORT_ERROR, NetPermissionFlags::None); } for (const auto& addrBind : options.vWhiteBinds) { - fBound |= Bind(addrBind.m_service, (BF_EXPLICIT | BF_REPORT_ERROR), addrBind.m_flags); + fBound |= Bind(addrBind.m_service, BF_REPORT_ERROR, addrBind.m_flags); } for (const auto& addr_bind : options.onion_binds) { - fBound |= Bind(addr_bind, BF_EXPLICIT | BF_DONT_ADVERTISE, NetPermissionFlags::None); + fBound |= Bind(addr_bind, BF_DONT_ADVERTISE, NetPermissionFlags::None); } if (options.bind_on_any) { struct in_addr inaddr_any; From 349cad2865627c8de6a5e59535e4cc0e37c3bdfc Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Sat, 17 Dec 2022 11:55:11 +0100 Subject: [PATCH 6/7] Merge bitcoin/bitcoin#26708: clang-tidy: Fix `modernize-use-nullptr` in headers adb7dba9de95c166103ac7eaf97d5bd83dc19605 clang-tidy: Fix `modernize-use-nullptr` in headers (Hennadii Stepanov) Pull request description: Split from bitcoin/bitcoin#26705 as was requested in https://github.com/bitcoin/bitcoin/pull/26705#issuecomment-1353293405. To test this PR, consider applying a diff as follows: ```diff --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -12,17 +12,9 @@ readability-redundant-declaration, readability-redundant-string-init, ' WarningsAsErrors: ' -bugprone-argument-comment, -bugprone-use-after-move, -misc-unused-using-decls, -modernize-use-default-member-init, modernize-use-nullptr, -performance-for-range-copy, -performance-move-const-arg, -performance-unnecessary-copy-initialization, -readability-redundant-declaration, -readability-redundant-string-init, ' CheckOptions: - key: performance-move-const-arg.CheckTriviallyCopyableMove value: false +HeaderFilterRegex: '.' ``` ACKs for top commit: john-moffett: ACK adb7dba9de95c166103ac7eaf97d5bd83dc19605 Tree-SHA512: 67241fb212d837157a0a26f0d59e7f30a9d270d5b0ebfeb6ad9631e460fc7fba8c9a9dcd4c0520789353f68025a9f090f40f17176472a93cce1411e6d56f930b --- src/tinyformat.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tinyformat.h b/src/tinyformat.h index 0211b52600..a9ed55058b 100644 --- a/src/tinyformat.h +++ b/src/tinyformat.h @@ -508,9 +508,9 @@ class FormatArg { public: FormatArg() - : m_value(NULL), - m_formatImpl(NULL), - m_toIntImpl(NULL) + : m_value(nullptr), + m_formatImpl(nullptr), + m_toIntImpl(nullptr) { } template @@ -1005,7 +1005,8 @@ class FormatListN : public FormatList // Special 0-arg version - MSVC says zero-sized C array in struct is nonstandard template<> class FormatListN<0> : public FormatList { - public: FormatListN() : FormatList(0, 0) {} +public: + FormatListN() : FormatList(nullptr, 0) {} }; } // namespace detail From fb8a4db8f67966a157e24ce96144127200b4a7ee Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Mon, 19 Dec 2022 09:22:05 +0100 Subject: [PATCH 7/7] Merge bitcoin/bitcoin#26717: test: Improve `check-doc.py` pattern 2b77a33e5b91a2e54c5e99b11bd775807ade024d test: Improve `check-doc.py` pattern (Hennadii Stepanov) Pull request description: On master (cb32328d1b80d0ccd6eb9532bd8fe4e0a4de385e): ``` $ ./test/lint/check-doc.py Args used : 158 Args documented : 219 Args undocumented: 0 set() Args unknown : 61 {'-stopatheight', '-maxtipage', '-maxreceivebuffer', '-txconfirmtarget', '-maxconnections', '-maxsigcachesize', '-peertimeout', '-limitancestorsize', '-output-csv', '-blockmaxweight', '-par', '-rpcclienttimeout', '-dbcrashratio', '-zmqpubsequence', '-zmqpubhashtxhwm', '-zmqpubrawblock', '-dbbatchsize', '-zmqpubrawtxhwm', '-includeconf', '-checkblocks', '-limitancestorcount', '-zmqpubrawtx', '-checklevel', '-checkmempool', '-rpcthreads', '-rpcworkqueue', '-zmqpubsequencehwm', '-zmqpubrawblockhwm', '-rpcservertimeout', '-testnet', '-zmqpubhashtx', '-signet', '-rpcwaittimeout', '-limitdescendantcount', '-output-json', '-maxmempool', '-mocktime', '-datacarriersize', '-rpcport', '-dbcache', '-zmqpubhashblockhwm', '-mempoolexpiry', '-settings', '-min-time', '-maxtimeadjustment', '-bytespersigop', '-blockversion', '-limitdescendantsize', '-maxorphantx', '-rpccookiefile', '-rpcserialversion', '-bantime', '-blockreconstructionextratxn', '-checkaddrman', '-debuglogfile', '-pid', '-dblogsize', '-timeout', '-zmqpubhashblock', '-maxsendbuffer', '-regtest'} ``` With this PR: ``` $ ./test/lint/check-doc.py Args used : 208 Args documented : 219 Args undocumented: 0 set() Args unknown : 11 {'-zmqpubrawblock', '-zmqpubhashblockhwm', '-zmqpubsequencehwm', '-zmqpubrawtx', '-zmqpubhashblock', '-zmqpubhashtx', '-includeconf', '-zmqpubhashtxhwm', '-zmqpubrawblockhwm', '-zmqpubrawtxhwm', '-zmqpubsequence'} ``` ACKs for top commit: vincenzopalazzo: ACK https://github.com/bitcoin/bitcoin/pull/26717/commits/2b77a33e5b91a2e54c5e99b11bd775807ade024d Tree-SHA512: 6cf4ccc4e8319aad8006ae915f0d25637ac12974fbc1f81808f26b72fbe2649e2b6ff993bc2c1894f81bd6756bff77491b3d56382c034a84fd50325a3c807d8b --- test/lint/check-doc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/lint/check-doc.py b/test/lint/check-doc.py index feaebc68e9..7955dd4f3e 100755 --- a/test/lint/check-doc.py +++ b/test/lint/check-doc.py @@ -15,7 +15,7 @@ import re FOLDER_GREP = 'src' FOLDER_TEST = 'src/test/' -REGEX_ARG = r'(?:ForceSet|SoftSet|Get|Is)(?:Bool)?Args?(?:Set)?\("(-[^"]+)"' +REGEX_ARG = r'\b(?:GetArg|GetArgs|GetBoolArg|GetIntArg|GetPathArg|IsArgSet|get_net)\("(-[^"]+)"' REGEX_DOC = r'AddArg\("(-[^"=]+?)(?:=|")' CMD_ROOT_DIR = '$(git rev-parse --show-toplevel)/{}'.format(FOLDER_GREP) CMD_GREP_ARGS = r"git grep --perl-regexp '{}' -- {} ':(exclude){}'".format(REGEX_ARG, CMD_ROOT_DIR, FOLDER_TEST)