merge bitcoin#17513: Nuke some circular dependencies

This commit is contained in:
Kittywhiskers Van Gogh 2019-11-19 11:10:40 +02:00 committed by PastaPastaPasta
parent 320b4b69ab
commit 0fe2c99e78
17 changed files with 98 additions and 62 deletions

View File

@ -148,6 +148,7 @@ BITCOIN_QT_H = \
qt/rpcconsole.h \ qt/rpcconsole.h \
qt/sendcoinsdialog.h \ qt/sendcoinsdialog.h \
qt/sendcoinsentry.h \ qt/sendcoinsentry.h \
qt/sendcoinsrecipient.h \
qt/signverifymessagedialog.h \ qt/signverifymessagedialog.h \
qt/splashscreen.h \ qt/splashscreen.h \
qt/trafficgraphdata.h \ qt/trafficgraphdata.h \

View File

@ -11,7 +11,7 @@
#include <qt/bitcoinunits.h> #include <qt/bitcoinunits.h>
#include <qt/optionsdialog.h> #include <qt/optionsdialog.h>
#include <qt/qvalidatedlineedit.h> #include <qt/qvalidatedlineedit.h>
#include <qt/walletmodel.h> #include <qt/sendcoinsrecipient.h>
#include <base58.h> #include <base58.h>
#include <chainparams.h> #include <chainparams.h>

View File

@ -7,7 +7,7 @@
#include <qt/forms/ui_openuridialog.h> #include <qt/forms/ui_openuridialog.h>
#include <qt/guiutil.h> #include <qt/guiutil.h>
#include <qt/walletmodel.h> #include <qt/sendcoinsrecipient.h>
#include <QUrl> #include <QUrl>

View File

@ -36,13 +36,17 @@
#include <config/bitcoin-config.h> #include <config/bitcoin-config.h>
#endif #endif
#include <qt/walletmodel.h> #include <qt/sendcoinsrecipient.h>
#include <QObject> #include <QObject>
#include <QString> #include <QString>
class OptionsModel; class OptionsModel;
namespace interfaces {
class Node;
} // namespace interfaces
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QApplication; class QApplication;
class QByteArray; class QByteArray;

View File

@ -9,6 +9,7 @@
#include <qt/guiutil.h> #include <qt/guiutil.h>
#include <qt/optionsmodel.h> #include <qt/optionsmodel.h>
#include <qt/qrimagewidget.h> #include <qt/qrimagewidget.h>
#include <qt/walletmodel.h>
#include <QClipboard> #include <QClipboard>
#include <QPixmap> #include <QPixmap>

View File

@ -5,10 +5,12 @@
#ifndef BITCOIN_QT_RECEIVEREQUESTDIALOG_H #ifndef BITCOIN_QT_RECEIVEREQUESTDIALOG_H
#define BITCOIN_QT_RECEIVEREQUESTDIALOG_H #define BITCOIN_QT_RECEIVEREQUESTDIALOG_H
#include <qt/walletmodel.h> #include <qt/sendcoinsrecipient.h>
#include <QDialog> #include <QDialog>
class WalletModel;
namespace Ui { namespace Ui {
class ReceiveRequestDialog; class ReceiveRequestDialog;
} }

View File

@ -7,6 +7,7 @@
#include <qt/bitcoinunits.h> #include <qt/bitcoinunits.h>
#include <qt/guiutil.h> #include <qt/guiutil.h>
#include <qt/optionsmodel.h> #include <qt/optionsmodel.h>
#include <qt/walletmodel.h>
#include <clientversion.h> #include <clientversion.h>
#include <streams.h> #include <streams.h>

View File

@ -5,12 +5,14 @@
#ifndef BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H #ifndef BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H
#define BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H #define BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H
#include <qt/walletmodel.h> #include <qt/sendcoinsrecipient.h>
#include <QAbstractTableModel> #include <QAbstractTableModel>
#include <QStringList> #include <QStringList>
#include <QDateTime> #include <QDateTime>
class WalletModel;
class RecentRequestEntry class RecentRequestEntry
{ {
public: public:

View File

@ -14,6 +14,7 @@
#include <qt/addresstablemodel.h> #include <qt/addresstablemodel.h>
#include <qt/guiutil.h> #include <qt/guiutil.h>
#include <qt/optionsmodel.h> #include <qt/optionsmodel.h>
#include <qt/walletmodel.h>
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>

View File

@ -5,12 +5,16 @@
#ifndef BITCOIN_QT_SENDCOINSENTRY_H #ifndef BITCOIN_QT_SENDCOINSENTRY_H
#define BITCOIN_QT_SENDCOINSENTRY_H #define BITCOIN_QT_SENDCOINSENTRY_H
#include <qt/walletmodel.h> #include <qt/sendcoinsrecipient.h>
#include <QStackedWidget> #include <QStackedWidget>
class WalletModel; class WalletModel;
namespace interfaces {
class Node;
} // namespace interfaces
namespace Ui { namespace Ui {
class SendCoinsEntry; class SendCoinsEntry;
} }

View File

@ -0,0 +1,64 @@
// Copyright (c) 2011-2019 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_SENDCOINSRECIPIENT_H
#define BITCOIN_QT_SENDCOINSRECIPIENT_H
#if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif
#include <amount.h>
#include <serialize.h>
#include <string>
#include <QString>
class SendCoinsRecipient
{
public:
explicit SendCoinsRecipient() : amount(0), fSubtractFeeFromAmount(false), nVersion(SendCoinsRecipient::CURRENT_VERSION) { }
explicit SendCoinsRecipient(const QString &addr, const QString &_label, const CAmount& _amount, const QString &_message):
address(addr), label(_label), amount(_amount), message(_message), fSubtractFeeFromAmount(false), nVersion(SendCoinsRecipient::CURRENT_VERSION) {}
// If from an unauthenticated payment request, this is used for storing
// the addresses, e.g. address-A<br />address-B<br />address-C.
// Info: As we don't need to process addresses in here when using
// payment requests, we can abuse it for displaying an address list.
// Todo: This is a hack, should be replaced with a cleaner solution!
QString address;
QString label;
CAmount amount;
// If from a payment request, this is used for storing the memo
QString message;
// Keep the payment request around as a serialized string to ensure
// load/store is lossless.
std::string sPaymentRequest;
// Empty if no authentication or invalid signature/cert/etc.
QString authenticatedMerchant;
bool fSubtractFeeFromAmount; // memory only
static const int CURRENT_VERSION = 1;
int nVersion;
SERIALIZE_METHODS(SendCoinsRecipient, obj)
{
std::string address_str, label_str, message_str, auth_merchant_str;
SER_WRITE(obj, address_str = obj.address.toStdString());
SER_WRITE(obj, label_str = obj.label.toStdString());
SER_WRITE(obj, message_str = obj.message.toStdString());
SER_WRITE(obj, auth_merchant_str = obj.authenticatedMerchant.toStdString());
READWRITE(obj.nVersion, address_str, label_str, obj.amount, message_str, obj.sPaymentRequest, auth_merchant_str);
SER_READ(obj, obj.address = QString::fromStdString(address_str));
SER_READ(obj, obj.label = QString::fromStdString(label_str));
SER_READ(obj, obj.message = QString::fromStdString(message_str));
SER_READ(obj, obj.authenticatedMerchant = QString::fromStdString(auth_merchant_str));
}
};
#endif // BITCOIN_QT_SENDCOINSRECIPIENT_H

View File

@ -17,9 +17,10 @@
#include <consensus/consensus.h> #include <consensus/consensus.h>
#include <key_io.h> #include <key_io.h>
#include <interfaces/node.h> #include <interfaces/node.h>
#include <validation.h> #include <interfaces/wallet.h>
#include <script/script.h> #include <script/script.h>
#include <util/system.h> #include <util/system.h>
#include <validation.h>
#include <wallet/ismine.h> #include <wallet/ismine.h>
#include <stdint.h> #include <stdint.h>

View File

@ -2,19 +2,20 @@
// Distributed under the MIT software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <qt/walletcontroller.h>
#include <qt/askpassphrasedialog.h> #include <qt/askpassphrasedialog.h>
#include <qt/clientmodel.h> #include <qt/clientmodel.h>
#include <qt/createwalletdialog.h> #include <qt/createwalletdialog.h>
#include <qt/guiconstants.h> #include <qt/guiconstants.h>
#include <qt/guiutil.h> #include <qt/guiutil.h>
#include <qt/walletcontroller.h> #include <qt/walletmodel.h>
#include <wallet/wallet.h>
#include <interfaces/handler.h> #include <interfaces/handler.h>
#include <interfaces/node.h> #include <interfaces/node.h>
#include <util/string.h> #include <util/string.h>
#include <util/translation.h> #include <util/translation.h>
#include <wallet/wallet.h>
#include <algorithm> #include <algorithm>

View File

@ -5,7 +5,7 @@
#ifndef BITCOIN_QT_WALLETCONTROLLER_H #ifndef BITCOIN_QT_WALLETCONTROLLER_H
#define BITCOIN_QT_WALLETCONTROLLER_H #define BITCOIN_QT_WALLETCONTROLLER_H
#include <qt/walletmodel.h> #include <qt/sendcoinsrecipient.h>
#include <support/allocators/secure.h> #include <support/allocators/secure.h>
#include <sync.h> #include <sync.h>
#include <util/translation.h> #include <util/translation.h>
@ -25,10 +25,12 @@
class ClientModel; class ClientModel;
class OptionsModel; class OptionsModel;
class PlatformStyle; class PlatformStyle;
class WalletModel;
namespace interfaces { namespace interfaces {
class Handler; class Handler;
class Node; class Node;
class Wallet;
} // namespace interfaces } // namespace interfaces
class AskPassphraseDialog; class AskPassphraseDialog;

View File

@ -5,9 +5,7 @@
#ifndef BITCOIN_QT_WALLETMODEL_H #ifndef BITCOIN_QT_WALLETMODEL_H
#define BITCOIN_QT_WALLETMODEL_H #define BITCOIN_QT_WALLETMODEL_H
#include <amount.h>
#include <key.h> #include <key.h>
#include <serialize.h>
#include <script/standard.h> #include <script/standard.h>
#if defined(HAVE_CONFIG_H) #if defined(HAVE_CONFIG_H)
@ -27,6 +25,7 @@ class AddressTableModel;
class ClientModel; class ClientModel;
class OptionsModel; class OptionsModel;
class RecentRequestsTableModel; class RecentRequestsTableModel;
class SendCoinsRecipient;
class TransactionTableModel; class TransactionTableModel;
class WalletModelTransaction; class WalletModelTransaction;
@ -45,51 +44,6 @@ QT_BEGIN_NAMESPACE
class QTimer; class QTimer;
QT_END_NAMESPACE QT_END_NAMESPACE
class SendCoinsRecipient
{
public:
explicit SendCoinsRecipient() : amount(0), fSubtractFeeFromAmount(false), nVersion(SendCoinsRecipient::CURRENT_VERSION) { }
explicit SendCoinsRecipient(const QString &addr, const QString &_label, const CAmount& _amount, const QString &_message):
address(addr), label(_label), amount(_amount), message(_message), fSubtractFeeFromAmount(false), nVersion(SendCoinsRecipient::CURRENT_VERSION) {}
// If from an unauthenticated payment request, this is used for storing
// the addresses, e.g. address-A<br />address-B<br />address-C.
// Info: As we don't need to process addresses in here when using
// payment requests, we can abuse it for displaying an address list.
// Todo: This is a hack, should be replaced with a cleaner solution!
QString address;
QString label;
CAmount amount;
// If from a payment request, this is used for storing the memo
QString message;
// Keep the payment request around as a serialized string to ensure
// load/store is lossless.
std::string sPaymentRequest;
// Empty if no authentication or invalid signature/cert/etc.
QString authenticatedMerchant;
bool fSubtractFeeFromAmount; // memory only
static const int CURRENT_VERSION = 1;
int nVersion;
SERIALIZE_METHODS(SendCoinsRecipient, obj)
{
std::string address_str, label_str, message_str, auth_merchant_str;
SER_WRITE(obj, address_str = obj.address.toStdString());
SER_WRITE(obj, label_str = obj.label.toStdString());
SER_WRITE(obj, message_str = obj.message.toStdString());
SER_WRITE(obj, auth_merchant_str = obj.authenticatedMerchant.toStdString());
READWRITE(obj.nVersion, address_str, label_str, obj.amount, message_str, obj.sPaymentRequest, auth_merchant_str);
SER_READ(obj, obj.address = QString::fromStdString(address_str));
SER_READ(obj, obj.label = QString::fromStdString(label_str));
SER_READ(obj, obj.message = QString::fromStdString(message_str));
SER_READ(obj, obj.authenticatedMerchant = QString::fromStdString(auth_merchant_str));
}
};
/** Interface to Bitcoin wallet from Qt view code. */ /** Interface to Bitcoin wallet from Qt view code. */
class WalletModel : public QObject class WalletModel : public QObject
{ {

View File

@ -5,7 +5,8 @@
#ifndef BITCOIN_QT_WALLETMODELTRANSACTION_H #ifndef BITCOIN_QT_WALLETMODELTRANSACTION_H
#define BITCOIN_QT_WALLETMODELTRANSACTION_H #define BITCOIN_QT_WALLETMODELTRANSACTION_H
#include <qt/walletmodel.h> #include <primitives/transaction.h>
#include <qt/sendcoinsrecipient.h>
#include <amount.h> #include <amount.h>

View File

@ -14,10 +14,8 @@ EXPECTED_CIRCULAR_DEPENDENCIES=(
"policy/fees -> txmempool -> policy/fees" "policy/fees -> txmempool -> policy/fees"
"qt/addresstablemodel -> qt/walletmodel -> qt/addresstablemodel" "qt/addresstablemodel -> qt/walletmodel -> qt/addresstablemodel"
"qt/bitcoingui -> qt/walletframe -> qt/bitcoingui" "qt/bitcoingui -> qt/walletframe -> qt/bitcoingui"
"qt/paymentserver -> qt/walletmodel -> qt/paymentserver"
"qt/recentrequeststablemodel -> qt/walletmodel -> qt/recentrequeststablemodel" "qt/recentrequeststablemodel -> qt/walletmodel -> qt/recentrequeststablemodel"
"qt/transactiontablemodel -> qt/walletmodel -> qt/transactiontablemodel" "qt/transactiontablemodel -> qt/walletmodel -> qt/transactiontablemodel"
"qt/walletmodel -> qt/walletmodeltransaction -> qt/walletmodel"
"txmempool -> validation -> txmempool" "txmempool -> validation -> txmempool"
"wallet/fees -> wallet/wallet -> wallet/fees" "wallet/fees -> wallet/wallet -> wallet/fees"
"wallet/wallet -> wallet/walletdb -> wallet/wallet" "wallet/wallet -> wallet/walletdb -> wallet/wallet"
@ -55,7 +53,6 @@ EXPECTED_CIRCULAR_DEPENDENCIES=(
"qt/bitcoingui -> qt/guiutil -> qt/bitcoingui" "qt/bitcoingui -> qt/guiutil -> qt/bitcoingui"
"qt/guiutil -> qt/optionsdialog -> qt/guiutil" "qt/guiutil -> qt/optionsdialog -> qt/guiutil"
"qt/guiutil -> qt/qvalidatedlineedit -> qt/guiutil" "qt/guiutil -> qt/qvalidatedlineedit -> qt/guiutil"
"qt/clientmodel -> qt/guiutil -> qt/walletmodel -> qt/clientmodel"
"core_io -> evo/cbtx -> evo/deterministicmns -> core_io" "core_io -> evo/cbtx -> evo/deterministicmns -> core_io"
"core_io -> evo/cbtx -> evo/simplifiedmns -> core_io" "core_io -> evo/cbtx -> evo/simplifiedmns -> core_io"
"evo/simplifiedmns -> llmq/blockprocessor -> net_processing -> evo/simplifiedmns" "evo/simplifiedmns -> llmq/blockprocessor -> net_processing -> evo/simplifiedmns"