Skip to content

Commit e37eb41

Browse files
2 parents 09b5833 + 7a39d5d commit e37eb41

30 files changed

+230
-104
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ linux-build
128128
win32-build
129129
test/config.ini
130130
test/cache/*
131+
test/.mypy_cache/
131132

132133
!src/leveldb*/Makefile
133134

ci/lint/04_install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ travis_retry pip3 install codespell==1.17.1
1414
travis_retry pip3 install flake8==3.8.3
1515
travis_retry pip3 install vulture==2.3
1616
travis_retry pip3 install yq
17+
travis_retry pip3 install mypy==0.700
1718

1819
SHELLCHECK_VERSION=v0.6.0
1920
curl -s "https://storage.googleapis.com/shellcheck/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | tar --xz -xf - --directory /tmp/

contrib/containers/ci/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ RUN apt-get update && apt-get install $APT_ARGS \
4040
libxcb-xinerama0 \
4141
libxcb-xkb1 \
4242
libxkbcommon-x11-0 \
43+
mypy \
4344
wget \
4445
unzip \
4546
m4 \

doc/release-notes-18982.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Notification changes
2+
--------------------
3+
4+
`-walletnotify` notifications are now sent for wallet transactions that are
5+
removed from the mempool because they conflict with a new block. These
6+
notifications were sent previously before the v18.1 release, but had been
7+
broken since that release.

src/init.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include <script/sigcache.h>
5252
#include <script/standard.h>
5353
#include <shutdown.h>
54+
#include <sync.h>
5455
#include <timedata.h>
5556
#include <torcontrol.h>
5657
#include <txdb.h>
@@ -65,6 +66,7 @@
6566
#include <util/threadnames.h>
6667
#include <util/translation.h>
6768
#include <validation.h>
69+
6870
#include <validationinterface.h>
6971

7072
#include <masternode/node.h>
@@ -217,11 +219,10 @@ void Interrupt(NodeContext& node)
217219
/** Preparing steps before shutting down or restarting the wallet */
218220
void PrepareShutdown(NodeContext& node)
219221
{
222+
static Mutex g_shutdown_mutex;
223+
TRY_LOCK(g_shutdown_mutex, lock_shutdown);
224+
if (!lock_shutdown) return;
220225
LogPrintf("%s: In progress...\n", __func__);
221-
static RecursiveMutex cs_Shutdown;
222-
TRY_LOCK(cs_Shutdown, lockShutdown);
223-
if (!lockShutdown)
224-
return;
225226
Assert(node.args);
226227

227228
/// Note: Shutdown() must be able to handle cases in which initialization failed part of the way,

src/interfaces/chain.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class CFeeRate;
2727
class CBlockIndex;
2828
class Coin;
2929
class uint256;
30+
enum class MemPoolRemovalReason;
3031
struct bilingual_str;
3132
struct CBlockLocator;
3233
struct FeeCalculation;
@@ -258,7 +259,7 @@ class Chain
258259
public:
259260
virtual ~Notifications() {}
260261
virtual void transactionAddedToMempool(const CTransactionRef& tx, int64_t nAcceptTime) {}
261-
virtual void transactionRemovedFromMempool(const CTransactionRef& ptx, MemPoolRemovalReason reason) {}
262+
virtual void transactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason) {}
262263
virtual void blockConnected(const CBlock& block, int height) {}
263264
virtual void blockDisconnected(const CBlock& block, int height) {}
264265
virtual void updatedBlockTip() {}

src/qt/bitcoin.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,6 @@ BitcoinApplication::~BitcoinApplication()
228228
settings.clear();
229229
settings.sync();
230230
}
231-
delete optionsModel;
232-
optionsModel = nullptr;
233231
}
234232

235233
#ifdef ENABLE_WALLET
@@ -241,7 +239,7 @@ void BitcoinApplication::createPaymentServer()
241239

242240
void BitcoinApplication::createOptionsModel(bool resetSettings)
243241
{
244-
optionsModel = new OptionsModel(m_node, nullptr, resetSettings);
242+
optionsModel = new OptionsModel(m_node, this, resetSettings);
245243
}
246244

247245
void BitcoinApplication::createWindow(const NetworkStyle *networkStyle)
@@ -412,7 +410,7 @@ void BitcoinApplication::shutdownResult()
412410

413411
void BitcoinApplication::handleRunawayException(const QString &message)
414412
{
415-
QMessageBox::critical(nullptr, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. %1 can no longer continue safely and will quit.").arg(PACKAGE_NAME) + QString("\n\n") + message);
413+
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);
416414
::exit(EXIT_FAILURE);
417415
}
418416

src/qt/guiutil.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,15 @@
5959
#include <QLineEdit>
6060
#include <QList>
6161
#include <QLocale>
62+
#include <QMenu>
6263
#include <QMouseEvent>
6364
#include <QPointer>
6465
#include <QProgressDialog>
6566
#include <QScreen>
6667
#include <QSettings>
68+
#include <QShortcut>
6769
#include <QSize>
6870
#include <QString>
69-
#include <QShortcut>
7071
#include <QTextDocument> // for Qt::mightBeRichText
7172
#include <QThread>
7273
#include <QTimer>
@@ -454,7 +455,7 @@ QString HtmlEscape(const std::string& str, bool fMultiLine)
454455
return HtmlEscape(QString::fromStdString(str), fMultiLine);
455456
}
456457

457-
void copyEntryData(QAbstractItemView *view, int column, int role)
458+
void copyEntryData(const QAbstractItemView *view, int column, int role)
458459
{
459460
if(!view || !view->selectionModel())
460461
return;
@@ -467,13 +468,20 @@ void copyEntryData(QAbstractItemView *view, int column, int role)
467468
}
468469
}
469470

470-
QList<QModelIndex> getEntryData(QAbstractItemView *view, int column)
471+
QList<QModelIndex> getEntryData(const QAbstractItemView *view, int column)
471472
{
472473
if(!view || !view->selectionModel())
473474
return QList<QModelIndex>();
474475
return view->selectionModel()->selectedRows(column);
475476
}
476477

478+
bool hasEntryData(const QAbstractItemView *view, int column, int role)
479+
{
480+
QModelIndexList selection = getEntryData(view, column);
481+
if (selection.isEmpty()) return false;
482+
return !selection.at(0).data(role).toString().isEmpty();
483+
}
484+
477485
QString getDefaultDataDirectory()
478486
{
479487
return boostPathToQString(GetDefaultDataDir());
@@ -1926,6 +1934,13 @@ void LogQtInfo()
19261934
}
19271935
}
19281936

1937+
void PopupMenu(QMenu* menu, const QPoint& point, QAction* at_action)
1938+
{
1939+
// The qminimal plugin does not provide window system integration.
1940+
if (QApplication::platformName() == "minimal") return;
1941+
menu->popup(point, at_action);
1942+
}
1943+
19291944
QDateTime StartOfDay(const QDate& date)
19301945
{
19311946
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))

src/qt/guiutil.h

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ class Node;
3232
QT_BEGIN_NAMESPACE
3333
class QAbstractButton;
3434
class QAbstractItemView;
35+
class QAction;
3536
class QButtonGroup;
3637
class QDateTime;
3738
class QFont;
3839
class QLineEdit;
40+
class QMenu;
41+
class QPoint;
3942
class QProgressDialog;
4043
class QUrl;
4144
class QWidget;
@@ -137,14 +140,21 @@ namespace GUIUtil
137140
@param[in] role Data role to extract from the model
138141
@see TransactionView::copyLabel, TransactionView::copyAmount, TransactionView::copyAddress
139142
*/
140-
void copyEntryData(QAbstractItemView *view, int column, int role=Qt::EditRole);
143+
void copyEntryData(const QAbstractItemView *view, int column, int role=Qt::EditRole);
141144

142145
/** Return a field of the currently selected entry as a QString. Does nothing if nothing
143146
is selected.
144147
@param[in] column Data column to extract from the model
145148
@see TransactionView::copyLabel, TransactionView::copyAmount, TransactionView::copyAddress
146149
*/
147-
QList<QModelIndex> getEntryData(QAbstractItemView *view, int column);
150+
QList<QModelIndex> getEntryData(const QAbstractItemView *view, int column);
151+
152+
/** Returns true if the specified field of the currently selected view entry is not empty.
153+
@param[in] column Data column to extract from the model
154+
@param[in] role Data role to extract from the model
155+
@see TransactionView::contextualMenu
156+
*/
157+
bool hasEntryData(const QAbstractItemView *view, int column, int role);
148158

149159
void setClipboard(const QString& str);
150160

@@ -490,6 +500,11 @@ namespace GUIUtil
490500
*/
491501
void LogQtInfo();
492502

503+
/**
504+
* Call QMenu::popup() only on supported QT_QPA_PLATFORM.
505+
*/
506+
void PopupMenu(QMenu* menu, const QPoint& point, QAction* at_action = nullptr);
507+
493508
/**
494509
* Returns the start-moment of the day in local time.
495510
*
@@ -525,8 +540,6 @@ namespace GUIUtil
525540
return string.split(separator, QString::SkipEmptyParts);
526541
#endif
527542
}
528-
529-
530543
} // namespace GUIUtil
531544

532545
#endif // BITCOIN_QT_GUIUTIL_H

src/qt/modaloverlay.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
#include <qt/modaloverlay.h>
66
#include <qt/forms/ui_modaloverlay.h>
77

8-
#include <qt/guiutil.h>
9-
108
#include <chainparams.h>
9+
#include <qt/guiutil.h>
1110

12-
#include <QResizeEvent>
11+
#include <QEasingCurve>
1312
#include <QPropertyAnimation>
13+
#include <QResizeEvent>
1414

1515
ModalOverlay::ModalOverlay(bool enable_wallet, QWidget *parent) :
1616
QWidget(parent),
@@ -47,6 +47,11 @@ foreverHidden(false)
4747
ui->infoText->setVisible(false);
4848
ui->infoTextStrong->setText(tr("%1 is currently syncing. It will download headers and blocks from peers and validate them until reaching the tip of the block chain.").arg(PACKAGE_NAME));
4949
}
50+
51+
m_animation.setTargetObject(this);
52+
m_animation.setPropertyName("pos");
53+
m_animation.setDuration(300 /* ms */);
54+
m_animation.setEasingCurve(QEasingCurve::OutQuad);
5055
}
5156

5257
ModalOverlay::~ModalOverlay()
@@ -62,6 +67,9 @@ bool ModalOverlay::eventFilter(QObject * obj, QEvent * ev) {
6267
if (!layerIsVisible)
6368
setGeometry(0, height(), width(), height());
6469

70+
if (m_animation.endValue().toPoint().y() > 0) {
71+
m_animation.setEndValue(QPoint(0, height()));
72+
}
6573
}
6674
else if (ev->type() == QEvent::ChildAdded) {
6775
raise();
@@ -182,14 +190,10 @@ void ModalOverlay::showHide(bool hide, bool userRequested)
182190
if (!isVisible() && !hide)
183191
setVisible(true);
184192

185-
setGeometry(0, hide ? 0 : height(), width(), height());
186-
187-
QPropertyAnimation* animation = new QPropertyAnimation(this, "pos");
188-
animation->setDuration(300);
189-
animation->setStartValue(QPoint(0, hide ? 0 : this->height()));
190-
animation->setEndValue(QPoint(0, hide ? this->height() : 0));
191-
animation->setEasingCurve(QEasingCurve::OutQuad);
192-
animation->start(QAbstractAnimation::DeleteWhenStopped);
193+
m_animation.setStartValue(QPoint(0, hide ? 0 : height()));
194+
// The eventFilter() updates the endValue if it is required for QEvent::Resize.
195+
m_animation.setEndValue(QPoint(0, hide ? height() : 0));
196+
m_animation.start(QAbstractAnimation::KeepWhenStopped);
193197
layerIsVisible = !hide;
194198
}
195199

0 commit comments

Comments
 (0)