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/sendcoinsdialog.h \
qt/sendcoinsentry.h \
qt/sendcoinsrecipient.h \
qt/signverifymessagedialog.h \
qt/splashscreen.h \
qt/trafficgraphdata.h \

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,12 +5,16 @@
#ifndef BITCOIN_QT_SENDCOINSENTRY_H
#define BITCOIN_QT_SENDCOINSENTRY_H
#include <qt/walletmodel.h>
#include <qt/sendcoinsrecipient.h>
#include <QStackedWidget>
class WalletModel;
namespace interfaces {
class Node;
} // namespace interfaces
namespace Ui {
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 <key_io.h>
#include <interfaces/node.h>
#include <validation.h>
#include <interfaces/wallet.h>
#include <script/script.h>
#include <util/system.h>
#include <validation.h>
#include <wallet/ismine.h>
#include <stdint.h>

View File

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

View File

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

View File

@ -5,9 +5,7 @@
#ifndef BITCOIN_QT_WALLETMODEL_H
#define BITCOIN_QT_WALLETMODEL_H
#include <amount.h>
#include <key.h>
#include <serialize.h>
#include <script/standard.h>
#if defined(HAVE_CONFIG_H)
@ -27,6 +25,7 @@ class AddressTableModel;
class ClientModel;
class OptionsModel;
class RecentRequestsTableModel;
class SendCoinsRecipient;
class TransactionTableModel;
class WalletModelTransaction;
@ -45,51 +44,6 @@ QT_BEGIN_NAMESPACE
class QTimer;
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. */
class WalletModel : public QObject
{

View File

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

View File

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