From 0b238718a07978f36e5fe414227a2676928f75d1 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 7 Nov 2022 18:24:24 -0500 Subject: [PATCH] qt: Add a dialog to select the change output when bumping fee In order to correctly choose the change output when doing fee bumping in the GUI, we need to ask the user which output is change. We can make a guess using our ScriptIsChange heuristic, however the user may have chosen to have a custom change address or have otherwise labeled their change address which makes our change detection fail. By asking the user when fee bumping, we can avoid adding additional change outputs that are unnecessary. --- .../libbitcoin_qt/libbitcoin_qt.vcxproj | 2 + src/Makefile.qt.include | 4 + src/qt/bumpfeechoosechangedialog.cpp | 75 ++++++++++++ src/qt/bumpfeechoosechangedialog.h | 36 ++++++ src/qt/forms/bumpfeechoosechangedialog.ui | 109 ++++++++++++++++++ src/qt/test/wallettests.cpp | 36 +++++- src/qt/walletmodel.cpp | 12 +- test/lint/lint-circular-dependencies.py | 1 + 8 files changed, 272 insertions(+), 3 deletions(-) create mode 100644 src/qt/bumpfeechoosechangedialog.cpp create mode 100644 src/qt/bumpfeechoosechangedialog.h create mode 100644 src/qt/forms/bumpfeechoosechangedialog.ui diff --git a/build_msvc/libbitcoin_qt/libbitcoin_qt.vcxproj b/build_msvc/libbitcoin_qt/libbitcoin_qt.vcxproj index 9f9dc9d5fa0..c9c53ecd993 100644 --- a/build_msvc/libbitcoin_qt/libbitcoin_qt.vcxproj +++ b/build_msvc/libbitcoin_qt/libbitcoin_qt.vcxproj @@ -17,6 +17,7 @@ + @@ -73,6 +74,7 @@ + diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 7852d1a2fa9..96667137ade 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -16,6 +16,7 @@ include Makefile.qt_locale.include QT_FORMS_UI = \ qt/forms/addressbookpage.ui \ qt/forms/askpassphrasedialog.ui \ + qt/forms/bumpfeechoosechangedialog.ui \ qt/forms/coincontroldialog.ui \ qt/forms/createwalletdialog.ui \ qt/forms/editaddressdialog.ui \ @@ -38,6 +39,7 @@ QT_MOC_CPP = \ qt/moc_addressbookpage.cpp \ qt/moc_addresstablemodel.cpp \ qt/moc_askpassphrasedialog.cpp \ + qt/moc_bumpfeechoosechangedialog.cpp \ qt/moc_createwalletdialog.cpp \ qt/moc_bantablemodel.cpp \ qt/moc_bitcoin.cpp \ @@ -109,6 +111,7 @@ BITCOIN_QT_H = \ qt/addressbookpage.h \ qt/addresstablemodel.h \ qt/askpassphrasedialog.h \ + qt/bumpfeechoosechangedialog.h \ qt/bantablemodel.h \ qt/bitcoin.h \ qt/bitcoinaddressvalidator.h \ @@ -252,6 +255,7 @@ BITCOIN_QT_WALLET_CPP = \ qt/addressbookpage.cpp \ qt/addresstablemodel.cpp \ qt/askpassphrasedialog.cpp \ + qt/bumpfeechoosechangedialog.cpp \ qt/coincontroldialog.cpp \ qt/coincontroltreewidget.cpp \ qt/createwalletdialog.cpp \ diff --git a/src/qt/bumpfeechoosechangedialog.cpp b/src/qt/bumpfeechoosechangedialog.cpp new file mode 100644 index 00000000000..2432aa4e94d --- /dev/null +++ b/src/qt/bumpfeechoosechangedialog.cpp @@ -0,0 +1,75 @@ +// Copyright (c) 2022 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or https://www.opensource.org/licenses/mit-license.php. + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#include +#include + +#include +#include