Skip to content

Commit 181b0ba

Browse files
Merge dashpay#6829: backport: merge bitcoin-core/gui#594, #617, #612, #627, #711, #658, #813, #825, #626, #831, #835 (qt backports: part 5)
20763f1 merge bitcoin-core/gui#835: Fix crash when closing wallet (Kittywhiskers Van Gogh) b47b1f6 merge bitcoin-core/gui#831: GUIUtil::bringToFront workaround for Wayland (Kittywhiskers Van Gogh) 493768c merge bitcoin-core/gui#626: Showing Local Addresses in Node Window (Kittywhiskers Van Gogh) 4e1b06b merge bitcoin-core/gui#825: Show maximum mempool size in information window (Kittywhiskers Van Gogh) 568753a merge bitcoin-core/gui#813: Don't permit port in proxy IP option (Kittywhiskers Van Gogh) dc3771e merge bitcoin-core/gui#658: Never change the prune checkbox after the user has touched it (Kittywhiskers Van Gogh) 9f103fb fix: hide the entire transaction widget if discreet mode is enabled (Kittywhiskers Van Gogh) e9b347f merge bitcoin-core/gui#711: Disable unused special members functions in `UnlockContext` (Kittywhiskers Van Gogh) 8829549 merge bitcoin-core/gui#627: Apply translator comments to reset options confirmation dialog (Kittywhiskers Van Gogh) d496df0 merge bitcoin-core/gui#612: Drop unused `QFrame`s in `SendCoinsEntry` (Kittywhiskers Van Gogh) 9e4ee65 merge bitcoin-core/gui#617: Reset options, notify user about backup creation (Kittywhiskers Van Gogh) cc2df46 merge bitcoin-core/gui#594: replace deprecated Q_OS_MAC with Q_OS_MACOS (Kittywhiskers Van Gogh) Pull request description: ## Additional Information | `develop` (e23a658) | This PR | | ------------------------------------------------------------ | ------------------------------------------------------------ | | ![image](https://github.com/user-attachments/assets/a792bcac-f6f1-4a25-929d-7abc1161625f) | ![image](https://github.com/user-attachments/assets/12daab53-2f84-41c5-938c-87eea367242f) | | ![image](https://github.com/user-attachments/assets/fc7ae896-e110-41f7-acd0-cff45e8e3774) | ![image](https://github.com/user-attachments/assets/4441816a-dd2d-4585-a6c9-7aaa771ba65b) | | ![image](https://github.com/user-attachments/assets/e884561d-1eef-461b-b852-2fadb493e4e3) | ![image](https://github.com/user-attachments/assets/89edd930-da0c-4d67-b767-1f3298e11a61) | ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 20763f1 Tree-SHA512: 6e047d42685f9f710cd966b838ba354f57628e31314f73fc3f6f9b48bbf8fadac1940a48d19b8cfcf9cee47ec00a16a6f21d43c905d1683fba20e42633054606
2 parents c192119 + 20763f1 commit 181b0ba

31 files changed

+394
-1339
lines changed

src/interfaces/node.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,18 @@ class Node
233233
//! Get mempool dynamic usage.
234234
virtual size_t getMempoolDynamicUsage() = 0;
235235

236+
//! Get mempool maximum memory usage.
237+
virtual size_t getMempoolMaxUsage() = 0;
238+
236239
//! Get header tip height and time.
237240
virtual bool getHeaderTip(int& height, int64_t& block_time) = 0;
238241

239242
//! Get num blocks.
240243
virtual int getNumBlocks() = 0;
241244

245+
//! Get network local addresses.
246+
virtual std::map<CNetAddr, LocalServiceInfo> getNetLocalAddresses() = 0;
247+
242248
//! Get best block hash.
243249
virtual uint256 getBestBlockHash() = 0;
244250

src/net.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4449,10 +4449,17 @@ size_t CConnman::GetNodeCount(ConnectionDirection flags) const
44494449
return nNum;
44504450
}
44514451

4452+
std::map<CNetAddr, LocalServiceInfo> CConnman::getNetLocalAddresses() const
4453+
{
4454+
LOCK(g_maplocalhost_mutex);
4455+
return mapLocalHost;
4456+
}
4457+
44524458
size_t CConnman::GetMaxOutboundNodeCount()
44534459
{
44544460
return m_max_outbound;
44554461
}
4462+
44564463
size_t CConnman::GetMaxOutboundOnionNodeCount()
44574464
{
44584465
return m_max_outbound_onion;

src/net.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,7 @@ friend class CNode;
14921492
void AddPendingProbeConnections(const std::set<uint256>& proTxHashes);
14931493

14941494
size_t GetNodeCount(ConnectionDirection) const;
1495+
std::map<CNetAddr, LocalServiceInfo> getNetLocalAddresses() const;
14951496
size_t GetMaxOutboundNodeCount();
14961497
size_t GetMaxOutboundOnionNodeCount();
14971498
void GetNodeStats(std::vector<CNodeStats>& vstats) const;

src/node/interfaces.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ class NodeImpl : public Node
519519
int64_t getTotalBytesSent() override { return m_context->connman ? m_context->connman->GetTotalBytesSent() : 0; }
520520
size_t getMempoolSize() override { return m_context->mempool ? m_context->mempool->size() : 0; }
521521
size_t getMempoolDynamicUsage() override { return m_context->mempool ? m_context->mempool->DynamicMemoryUsage() : 0; }
522+
size_t getMempoolMaxUsage() override { return gArgs.GetIntArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000; }
522523
bool getHeaderTip(int& height, int64_t& block_time) override
523524
{
524525
LOCK(::cs_main);
@@ -530,6 +531,13 @@ class NodeImpl : public Node
530531
}
531532
return false;
532533
}
534+
std::map<CNetAddr, LocalServiceInfo> getNetLocalAddresses() override
535+
{
536+
if (m_context->connman)
537+
return m_context->connman->getNetLocalAddresses();
538+
else
539+
return {};
540+
}
533541
int getNumBlocks() override
534542
{
535543
LOCK(::cs_main);

src/qt/bitcoingui.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <qt/walletview.h>
2727
#endif // ENABLE_WALLET
2828

29-
#ifdef Q_OS_MAC
29+
#ifdef Q_OS_MACOS
3030
#include <qt/macdockiconhandler.h>
3131
#endif
3232

@@ -74,7 +74,7 @@
7474

7575

7676
const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
77-
#if defined(Q_OS_MAC)
77+
#if defined(Q_OS_MACOS)
7878
"macosx"
7979
#elif defined(Q_OS_WIN)
8080
"windows"
@@ -228,7 +228,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const NetworkStyle* networkStyle,
228228
connect(labelBlocksIcon, &GUIUtil::ClickableLabel::clicked, this, &BitcoinGUI::showModalOverlay);
229229
connect(progressBar, &GUIUtil::ClickableProgressBar::clicked, this, &BitcoinGUI::showModalOverlay);
230230

231-
#ifdef Q_OS_MAC
231+
#ifdef Q_OS_MACOS
232232
m_app_nap_inhibitor = new CAppNapInhibitor;
233233
#endif
234234

@@ -261,7 +261,7 @@ BitcoinGUI::~BitcoinGUI()
261261
settings.setValue("MainWindowGeometry", saveGeometry());
262262
if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu)
263263
trayIcon->hide();
264-
#ifdef Q_OS_MAC
264+
#ifdef Q_OS_MACOS
265265
delete m_app_nap_inhibitor;
266266
MacDockIconHandler::cleanup();
267267
#endif
@@ -643,7 +643,7 @@ void BitcoinGUI::createMenuBar()
643643
minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized);
644644
});
645645

646-
#ifdef Q_OS_MAC
646+
#ifdef Q_OS_MACOS
647647
QAction* zoom_action = window_menu->addAction(tr("Zoom"));
648648
connect(zoom_action, &QAction::triggered, [] {
649649
QWindow* window = qApp->focusWindow();
@@ -660,7 +660,7 @@ void BitcoinGUI::createMenuBar()
660660
#endif
661661

662662
if (walletFrame) {
663-
#ifdef Q_OS_MAC
663+
#ifdef Q_OS_MACOS
664664
window_menu->addSeparator();
665665
QAction* main_window_action = window_menu->addAction(tr("Main Window"));
666666
connect(main_window_action, &QAction::triggered, [this] {
@@ -818,7 +818,7 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
818818
trayIcon->setContextMenu(trayIconMenu.get());
819819
createIconMenu(trayIconMenu.get());
820820

821-
#ifndef Q_OS_MAC
821+
#ifndef Q_OS_MACOS
822822
// Show main window on tray icon click
823823
// Note: ignore this on Mac - this is not the way tray should work there
824824
connect(trayIcon, &QSystemTrayIcon::activated, [this](QSystemTrayIcon::ActivationReason reason) {
@@ -904,7 +904,7 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
904904
#endif // ENABLE_WALLET
905905
unitDisplayControl->setOptionsModel(nullptr);
906906

907-
#ifdef Q_OS_MAC
907+
#ifdef Q_OS_MACOS
908908
if(dockIconMenu)
909909
{
910910
// Disable context menu on dock icon
@@ -1070,11 +1070,11 @@ void BitcoinGUI::createIconMenu(QMenu *pmenu)
10701070
{
10711071
// Configuration of the tray icon (or dock icon) icon menu
10721072
QAction* show_hide_action{nullptr};
1073-
#ifndef Q_OS_MAC
1073+
#ifndef Q_OS_MACOS
10741074
// Note: On macOS, the Dock icon is used to provide the tray's functionality.
10751075
show_hide_action = pmenu->addAction(QString(), this, &BitcoinGUI::toggleHidden);
10761076
pmenu->addSeparator();
1077-
#endif // Q_OS_MAC
1077+
#endif // Q_OS_MACOS
10781078

10791079
QAction* send_action{nullptr};
10801080
QAction* cj_send_action{nullptr};
@@ -1107,11 +1107,11 @@ void BitcoinGUI::createIconMenu(QMenu *pmenu)
11071107
backups_action = pmenu->addAction(showBackupsAction->text(), showBackupsAction, &QAction::trigger);
11081108
}
11091109
QAction* quit_action{nullptr};
1110-
#ifndef Q_OS_MAC
1110+
#ifndef Q_OS_MACOS
11111111
// Note: On macOS, the Dock icon's menu already has Quit action.
11121112
pmenu->addSeparator();
11131113
quit_action = pmenu->addAction(quitAction->text(), quitAction, &QAction::trigger);
1114-
#endif // Q_OS_MAC
1114+
#endif // Q_OS_MACOS
11151115

11161116
connect(
11171117
// Using QSystemTrayIcon::Context is not reliable.
@@ -1416,6 +1416,7 @@ void BitcoinGUI::openOptionsDialogWithTab(OptionsDialog::Tab tab)
14161416
auto dlg = new OptionsDialog(this, enableWallet);
14171417
connect(dlg, &OptionsDialog::quitOnReset, this, &BitcoinGUI::quitRequested);
14181418
dlg->setCurrentTab(tab);
1419+
dlg->setClientModel(clientModel);
14191420
dlg->setModel(clientModel->getOptionsModel());
14201421
connect(dlg, &OptionsDialog::appearanceChanged, [this]() {
14211422
updateWidth();
@@ -1489,7 +1490,7 @@ void BitcoinGUI::updateWidth()
14891490

14901491
void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool header, SynchronizationState sync_state)
14911492
{
1492-
#ifdef Q_OS_MAC
1493+
#ifdef Q_OS_MACOS
14931494
// Disabling macOS App Nap on initial sync, disk, reindex operations and mixing.
14941495
bool disableAppNap = !m_node.masternodeSync().isSynced() || sync_state != SynchronizationState::POST_INIT;
14951496
#ifdef ENABLE_WALLET
@@ -1504,7 +1505,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, const QStri
15041505
} else {
15051506
m_app_nap_inhibitor->enableAppNap();
15061507
}
1507-
#endif // Q_OS_MAC
1508+
#endif // Q_OS_MACOS
15081509

15091510
if (modalOverlay)
15101511
{
@@ -1719,7 +1720,7 @@ void BitcoinGUI::message(const QString& title, QString message, unsigned int sty
17191720
void BitcoinGUI::changeEvent(QEvent *e)
17201721
{
17211722
QMainWindow::changeEvent(e);
1722-
#ifndef Q_OS_MAC // Ignored on macOS
1723+
#ifndef Q_OS_MACOS // Ignored on macOS
17231724
if(e->type() == QEvent::WindowStateChange)
17241725
{
17251726
if(clientModel && clientModel->getOptionsModel() && clientModel->getOptionsModel()->getMinimizeToTray())
@@ -1753,7 +1754,7 @@ void BitcoinGUI::changeEvent(QEvent *e)
17531754

17541755
void BitcoinGUI::closeEvent(QCloseEvent *event)
17551756
{
1756-
#ifndef Q_OS_MAC // Ignored on macOS
1757+
#ifndef Q_OS_MACOS // Ignored on macOS
17571758
if(clientModel && clientModel->getOptionsModel())
17581759
{
17591760
if(!clientModel->getOptionsModel()->getMinimizeOnClose())

src/qt/bitcoingui.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#include <memory>
2626

27-
#ifdef Q_OS_MAC
27+
#ifdef Q_OS_MACOS
2828
#include <qt/macos_appnap.h>
2929
#endif
3030

@@ -193,7 +193,7 @@ class BitcoinGUI : public QMainWindow
193193

194194
QMenu* m_network_context_menu = new QMenu(this);
195195

196-
#ifdef Q_OS_MAC
196+
#ifdef Q_OS_MACOS
197197
CAppNapInhibitor* m_app_nap_inhibitor = nullptr;
198198
#endif
199199

src/qt/clientmodel.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ ClientModel::ClientModel(interfaces::Node& node, OptionsModel *_optionsModel, QO
5757
connect(timer, &QTimer::timeout, [this] {
5858
// no locking required at this point
5959
// the following calls will acquire the required lock
60-
Q_EMIT mempoolSizeChanged(m_node.getMempoolSize(), m_node.getMempoolDynamicUsage());
60+
Q_EMIT mempoolSizeChanged(m_node.getMempoolSize(), m_node.getMempoolDynamicUsage(), m_node.getMempoolMaxUsage());
6161
Q_EMIT islockCountChanged(m_node.llmq().getInstantSentLockCount());
6262
});
6363
connect(m_thread, &QThread::finished, timer, &QObject::deleteLater);
@@ -157,6 +157,11 @@ void ClientModel::getAllGovernanceObjects(std::vector<CGovernanceObject> &obj)
157157
m_node.gov().getAllNewerThan(obj, 0);
158158
}
159159

160+
std::map<CNetAddr, LocalServiceInfo> ClientModel::getNetLocalAddresses() const
161+
{
162+
return m_node.getNetLocalAddresses();
163+
}
164+
160165
int ClientModel::getNumBlocks() const
161166
{
162167
if (m_cached_num_blocks == -1) {

src/qt/clientmodel.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@
1616
#include <memory>
1717
#include <uint256.h>
1818

19+
#include <netaddress.h>
20+
1921
class BanTableModel;
2022
class CBlockIndex;
2123
class OptionsModel;
2224
class PeerTableModel;
2325
class PeerTableSortProxy;
2426
enum class SynchronizationState;
27+
struct LocalServiceInfo;
2528

2629
namespace interfaces {
2730
struct BlockTip;
@@ -68,6 +71,7 @@ class ClientModel : public QObject
6871

6972
//! Return number of connections, default is in- and outbound (total)
7073
int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const;
74+
std::map<CNetAddr, LocalServiceInfo> getNetLocalAddresses() const;
7175
int getNumBlocks() const;
7276
uint256 getBestBlockHash() EXCLUSIVE_LOCKS_REQUIRED(!m_cached_tip_mutex);
7377
int getHeaderTipHeight() const;
@@ -129,7 +133,7 @@ class ClientModel : public QObject
129133
void chainLockChanged(const QString& bestChainLockHash, int bestChainLockHeight);
130134
void numBlocksChanged(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool header, SynchronizationState sync_state);
131135
void additionalDataSyncProgressChanged(double nSyncProgress);
132-
void mempoolSizeChanged(long count, size_t mempoolSizeInBytes);
136+
void mempoolSizeChanged(long count, size_t mempoolSizeInBytes, size_t mempoolMaxSizeInBytes);
133137
void islockCountChanged(size_t count);
134138
void networkActiveChanged(bool networkActive);
135139
void alertsChanged(const QString &warnings);

0 commit comments

Comments
 (0)