Skip to content

Commit 7aa8f54

Browse files
21ad71c Merge bitcoin#21676: test: Use mocktime to avoid intermittent failure in rpc_tests (MarcoFalke) 76a41eb Merge bitcoin#21602: rpc: add additional ban time fields to listbanned (MarcoFalke) adea52a Merge bitcoin-core/gui#260: Handle exceptions instead of crash (W. J. van der Laan) 7e023c3 Merge bitcoin#17934: doc: Use CONFIG_SITE variable instead of --prefix option (fanquake) bc6e3ed Merge bitcoin#21606: fuzz: Extend psbt fuzz target a bit (MarcoFalke) 233fb24 Merge bitcoin#21445: cirrus: Use SSD cluster for speedup (fanquake) a224b80 Merge bitcoin#21609: ci: increase CPU count of sanitizer job to increase memory limit (MarcoFalke) ad94709 test: remove exception for util::Ref which doesn't exist more (Konstantin Akimov) 6674ee8 Merge bitcoin#21390: test: Test improvements for UTXO set hash tests (MarcoFalke) e10eec2 Merge bitcoin#21338: test: add functional test for anchors.dat (MarcoFalke) d9c31d6 Merge bitcoin#21411: test: add logging, reduce blocks, move sync_all in wallet_ groups (MarcoFalke) Pull request description: ## Issue being fixed or feature implemented Regular backports from bitcoin v22 ## Note for reviewers: PRs bitcoin#17934 and bitcoin#21606 have been backported partially in past. ## What was done? Removed unused sanitizer rules (see bitcoin#21366 and dashpay#5055) - bitcoin#21338 - bitcoin#21390 - bitcoin#21609 - bitcoin#21445 - bitcoin#21606 - bitcoin#17934 - bitcoin-core/gui#260 - bitcoin#21602 - bitcoin#21676 ## How Has This Been Tested? Run unit/functional tests ## Breaking Changes N/A ## Checklist: - [x] 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 ACKs for top commit: PastaPastaPasta: utACK 21ad71c Tree-SHA512: 94276d56255300d7d8c056d15b468720ba028d83cc585b16396e8bad90157e9e010490be239e09cccd4362f575f8df2d56dde3fb505745376c7790d70e3635cd
2 parents 54ea926 + 21ad71c commit 7aa8f54

29 files changed

+259
-60
lines changed

.cirrus.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ global_task_template: &GLOBAL_TASK_TEMPLATE
2929
# Each project has 16 CPU in total, assign 2 to each container, so that 8 tasks run in parallel
3030
cpu: 2
3131
memory: 8G # Set to 8GB to avoid OOM. https://cirrus-ci.org/guide/linux/#linux-containers
32-
kvm: true # Use kvm to avoid spurious CI failures in the default virtualization cluster, see https://github.com/bitcoin/bitcoin/issues/20093
3332
ccache_cache:
3433
folder: "/tmp/ccache_dir"
3534
depends_built_cache:
@@ -102,7 +101,7 @@ task:
102101
<< : *GLOBAL_TASK_TEMPLATE
103102
container:
104103
image: ubuntu:lunar
105-
cpu: 4 # Double CPU and increase Memory to avoid timeout
104+
cpu: 6 # Increase CPU and Memory to avoid timeout
106105
memory: 24G
107106
env:
108107
MAKEJOBS: "-j8"

doc/multiprocess.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The multiprocess feature requires [Cap'n Proto](https://capnproto.org/) and [lib
2424
```
2525
cd <DASH_SOURCE_DIRECTORY>
2626
make -C depends NO_QT=1 MULTIPROCESS=1
27-
./configure --prefix=$PWD/depends/x86_64-pc-linux-gnu
27+
CONFIG_SITE=$PWD/depends/x86_64-pc-linux-gnu/share/config.site ./configure
2828
make
2929
src/dash-node -regtest -printtoconsole -debug=ipc
3030
DASHD=dash-node test/functional/test_runner.py

doc/release-notes-21602.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Updated RPCs
2+
------------
3+
4+
5+
- The `listbanned` RPC now returns two new numeric fields: `ban_duration` and `time_remaining`.
6+
Respectively, these new fields indicate the duration of a ban and the time remaining until a ban expires,
7+
both in seconds. Additionally, the `ban_created` field is repositioned to come before `banned_until`. (#5976)

src/node/coinstats.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <map>
2020

21+
// Database-independent metric indicating the UTXO set size
2122
uint64_t GetBogoSize(const CScript& script_pub_key)
2223
{
2324
return 32 /* txid */ +

src/qt/bitcoin.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@
4747

4848
#include <QApplication>
4949
#include <QDebug>
50+
#include <QLatin1String>
5051
#include <QLibraryInfo>
5152
#include <QLocale>
5253
#include <QMessageBox>
5354
#include <QProcess>
5455
#include <QSettings>
56+
#include <QStringBuilder>
5557
#include <QThread>
5658
#include <QTimer>
5759
#include <QTranslator>
@@ -491,10 +493,23 @@ void BitcoinApplication::shutdownResult()
491493

492494
void BitcoinApplication::handleRunawayException(const QString &message)
493495
{
494-
QMessageBox::critical(nullptr, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. %1 can no longer continue safely and will quit.").arg(PACKAGE_NAME) + QString("<br><br>") + message);
496+
QMessageBox::critical(
497+
nullptr, tr("Runaway exception"),
498+
tr("A fatal error occurred. %1 can no longer continue safely and will quit.").arg(PACKAGE_NAME) %
499+
QLatin1String("<br><br>") % GUIUtil::MakeHtmlLink(message, PACKAGE_BUGREPORT));
495500
::exit(EXIT_FAILURE);
496501
}
497502

503+
void BitcoinApplication::handleNonFatalException(const QString& message)
504+
{
505+
assert(QThread::currentThread() == thread());
506+
QMessageBox::warning(
507+
nullptr, tr("Internal error"),
508+
tr("An internal error occurred. %1 will attempt to continue safely. This is "
509+
"an unexpected bug which can be reported as described below.").arg(PACKAGE_NAME) %
510+
QLatin1String("<br><br>") % GUIUtil::MakeHtmlLink(message, PACKAGE_BUGREPORT));
511+
}
512+
498513
WId BitcoinApplication::getMainWinId() const
499514
{
500515
if (!window)

src/qt/bitcoin.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ public Q_SLOTS:
9696
/// Handle runaway exceptions. Shows a message box with the problem and quits the program.
9797
void handleRunawayException(const QString &message);
9898

99+
/**
100+
* A helper function that shows a message box
101+
* with details about a non-fatal exception.
102+
*/
103+
void handleNonFatalException(const QString& message);
104+
99105
Q_SIGNALS:
100106
void requestedInitialize();
101107
void requestedRestart(QStringList args);

src/qt/bitcoingui.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ void BitcoinGUI::setWalletController(WalletController* wallet_controller)
891891
m_open_wallet_action->setEnabled(true);
892892
m_open_wallet_action->setMenu(m_open_wallet_menu);
893893

894-
connect(wallet_controller, &WalletController::walletAdded, this, &BitcoinGUI::addWallet);
894+
GUIUtil::ExceptionSafeConnect(wallet_controller, &WalletController::walletAdded, this, &BitcoinGUI::addWallet);
895895
connect(wallet_controller, &WalletController::walletRemoved, this, &BitcoinGUI::removeWallet);
896896

897897
for (WalletModel* wallet_model : m_wallet_controller->getOpenWallets()) {

src/qt/guiutil.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#include <QGuiApplication>
5353
#include <QJsonObject>
5454
#include <QKeyEvent>
55+
#include <QLatin1String>
5556
#include <QLineEdit>
5657
#include <QList>
5758
#include <QLocale>
@@ -65,6 +66,7 @@
6566
#include <QShortcut>
6667
#include <QSize>
6768
#include <QString>
69+
#include <QStringBuilder>
6870
#include <QTextDocument> // for Qt::mightBeRichText
6971
#include <QThread>
7072
#include <QTimer>
@@ -1874,4 +1876,22 @@ QImage GetImage(const QLabel* label)
18741876
#endif
18751877
}
18761878

1879+
QString MakeHtmlLink(const QString& source, const QString& link)
1880+
{
1881+
return QString(source).replace(
1882+
link,
1883+
QLatin1String("<a href=\"") % link % QLatin1String("\">") % link % QLatin1String("</a>"));
1884+
}
1885+
1886+
void PrintSlotException(
1887+
const std::exception* exception,
1888+
const QObject* sender,
1889+
const QObject* receiver)
1890+
{
1891+
std::string description = sender->metaObject()->className();
1892+
description += "->";
1893+
description += receiver->metaObject()->className();
1894+
PrintExceptionContinue(std::make_exception_ptr(exception), description.c_str());
1895+
}
1896+
18771897
} // namespace GUIUtil

src/qt/guiutil.h

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,23 @@
99
#include <fs.h>
1010
#include <qt/guiconstants.h>
1111
#include <netaddress.h>
12+
#include <util/check.h>
1213

14+
#include <QApplication>
1315
#include <QEvent>
1416
#include <QHeaderView>
1517
#include <QItemDelegate>
1618
#include <QMessageBox>
19+
#include <QMetaObject>
1720
#include <QObject>
1821
#include <QProgressBar>
1922
#include <QString>
2023
#include <QTableView>
2124
#include <QLabel>
2225

26+
#include <cassert>
2327
#include <chrono>
28+
#include <utility>
2429

2530
class QValidatedLineEdit;
2631
class OptionsModel;
@@ -520,6 +525,58 @@ namespace GUIUtil
520525
QObject::connect(&source, &QObject::destroyed, object, std::forward<Fn>(function), connection);
521526
}
522527

528+
/**
529+
* Replaces a plain text link with an HTML tagged one.
530+
*/
531+
QString MakeHtmlLink(const QString& source, const QString& link);
532+
533+
void PrintSlotException(
534+
const std::exception* exception,
535+
const QObject* sender,
536+
const QObject* receiver);
537+
538+
/**
539+
* A drop-in replacement of QObject::connect function
540+
* (see: https://doc.qt.io/qt-5/qobject.html#connect-3), that
541+
* guaranties that all exceptions are handled within the slot.
542+
*
543+
* NOTE: This function is incompatible with Qt private signals.
544+
*/
545+
template <typename Sender, typename Signal, typename Receiver, typename Slot>
546+
auto ExceptionSafeConnect(
547+
Sender sender, Signal signal, Receiver receiver, Slot method,
548+
Qt::ConnectionType type = Qt::AutoConnection)
549+
{
550+
return QObject::connect(
551+
sender, signal, receiver,
552+
[sender, receiver, method](auto&&... args) {
553+
bool ok{true};
554+
try {
555+
(receiver->*method)(std::forward<decltype(args)>(args)...);
556+
} catch (const NonFatalCheckError& e) {
557+
PrintSlotException(&e, sender, receiver);
558+
ok = QMetaObject::invokeMethod(
559+
qApp, "handleNonFatalException",
560+
blockingGUIThreadConnection(),
561+
Q_ARG(QString, QString::fromStdString(e.what())));
562+
} catch (const std::exception& e) {
563+
PrintSlotException(&e, sender, receiver);
564+
ok = QMetaObject::invokeMethod(
565+
qApp, "handleRunawayException",
566+
blockingGUIThreadConnection(),
567+
Q_ARG(QString, QString::fromStdString(e.what())));
568+
} catch (...) {
569+
PrintSlotException(nullptr, sender, receiver);
570+
ok = QMetaObject::invokeMethod(
571+
qApp, "handleRunawayException",
572+
blockingGUIThreadConnection(),
573+
Q_ARG(QString, "Unknown failure occurred."));
574+
}
575+
assert(ok);
576+
},
577+
type);
578+
}
579+
523580
} // namespace GUIUtil
524581

525582
#endif // BITCOIN_QT_GUIUTIL_H

src/qt/sendcoinsdialog.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ SendCoinsDialog::SendCoinsDialog(bool _fCoinJoin, QWidget* parent) :
153153
}
154154

155155
m_coin_control->UseCoinJoin(_fCoinJoin);
156+
157+
GUIUtil::ExceptionSafeConnect(ui->sendButton, &QPushButton::clicked, this, &SendCoinsDialog::sendButtonClicked);
156158
}
157159

158160
void SendCoinsDialog::setClientModel(ClientModel *_clientModel)
@@ -459,7 +461,7 @@ bool SendCoinsDialog::send(const QList<SendCoinsRecipient>& recipients, QString&
459461
return true;
460462
}
461463

462-
void SendCoinsDialog::on_sendButton_clicked()
464+
void SendCoinsDialog::sendButtonClicked([[maybe_unused]] bool checked)
463465
{
464466
if(!model || !model->getOptionsModel())
465467
return;

0 commit comments

Comments
 (0)