diff --git a/doc/developer-notes.md b/doc/developer-notes.md index b00cceb98..f8134c3aa 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -626,7 +626,7 @@ GUI holds: try to not directly access core data structures from Views. - Avoid adding slow or blocking code in the GUI thread. In particular do not - add new `interface::Node` and `interface::Wallet` method calls, even if they + add new `interfaces::Node` and `interfaces::Wallet` method calls, even if they may be fast now, in case they are changed to lock or communicate across processes in the future. diff --git a/src/Makefile.am b/src/Makefile.am index 605c93212..2c6ba6a6e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -105,9 +105,9 @@ BITCOIN_CORE_H = \ httpserver.h \ indirectmap.h \ init.h \ - interface/handler.h \ - interface/node.h \ - interface/wallet.h \ + interfaces/handler.h \ + interfaces/node.h \ + interfaces/wallet.h \ key.h \ key_io.h \ keystore.h \ @@ -249,7 +249,7 @@ endif libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libbitcoin_wallet_a_SOURCES = \ - interface/wallet.cpp \ + interfaces/wallet.cpp \ wallet/crypter.cpp \ wallet/db.cpp \ wallet/feebumper.cpp \ @@ -362,8 +362,8 @@ libbitcoin_util_a_SOURCES = \ compat/glibcxx_sanity.cpp \ compat/strnlen.cpp \ fs.cpp \ - interface/handler.cpp \ - interface/node.cpp \ + interfaces/handler.cpp \ + interfaces/node.cpp \ random.cpp \ rpc/protocol.cpp \ rpc/util.cpp \ diff --git a/src/interface/README.md b/src/interfaces/README.md similarity index 100% rename from src/interface/README.md rename to src/interfaces/README.md diff --git a/src/interface/handler.cpp b/src/interfaces/handler.cpp similarity index 89% rename from src/interface/handler.cpp rename to src/interfaces/handler.cpp index 4b27f374f..1443fe9f1 100644 --- a/src/interface/handler.cpp +++ b/src/interfaces/handler.cpp @@ -2,7 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include +#include #include @@ -10,7 +10,7 @@ #include #include -namespace interface { +namespace interfaces { namespace { class HandlerImpl : public Handler @@ -30,4 +30,4 @@ std::unique_ptr MakeHandler(boost::signals2::connection connection) return MakeUnique(std::move(connection)); } -} // namespace interface +} // namespace interfaces diff --git a/src/interface/handler.h b/src/interfaces/handler.h similarity index 82% rename from src/interface/handler.h rename to src/interfaces/handler.h index a76334bfb..c4c674cac 100644 --- a/src/interface/handler.h +++ b/src/interfaces/handler.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef BITCOIN_INTERFACE_HANDLER_H -#define BITCOIN_INTERFACE_HANDLER_H +#ifndef BITCOIN_INTERFACES_HANDLER_H +#define BITCOIN_INTERFACES_HANDLER_H #include @@ -13,7 +13,7 @@ class connection; } // namespace signals2 } // namespace boost -namespace interface { +namespace interfaces { //! Generic interface for managing an event handler or callback function //! registered with another interface. Has a single disconnect method to cancel @@ -30,6 +30,6 @@ public: //! Return handler wrapping a boost signal connection. std::unique_ptr MakeHandler(boost::signals2::connection connection); -} // namespace interface +} // namespace interfaces -#endif // BITCOIN_INTERFACE_HANDLER_H +#endif // BITCOIN_INTERFACES_HANDLER_H diff --git a/src/interface/node.cpp b/src/interfaces/node.cpp similarity index 98% rename from src/interface/node.cpp rename to src/interfaces/node.cpp index f04da4e17..919748f94 100644 --- a/src/interface/node.cpp +++ b/src/interfaces/node.cpp @@ -2,15 +2,15 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include +#include #include #include #include #include #include -#include -#include +#include +#include #include #include #include @@ -43,7 +43,7 @@ #include #include -namespace interface { +namespace interfaces { namespace { class NodeImpl : public Node @@ -305,4 +305,4 @@ class NodeImpl : public Node std::unique_ptr MakeNode() { return MakeUnique(); } -} // namespace interface +} // namespace interfaces diff --git a/src/interface/node.h b/src/interfaces/node.h similarity index 98% rename from src/interface/node.h rename to src/interfaces/node.h index 6ae7f9e46..f375af2f1 100644 --- a/src/interface/node.h +++ b/src/interfaces/node.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef BITCOIN_INTERFACE_NODE_H -#define BITCOIN_INTERFACE_NODE_H +#ifndef BITCOIN_INTERFACES_NODE_H +#define BITCOIN_INTERFACES_NODE_H #include // For banmap_t #include // For CAmount @@ -29,7 +29,7 @@ class proxyType; enum class FeeReason; struct CNodeStateStats; -namespace interface { +namespace interfaces { class Handler; class Wallet; @@ -254,6 +254,6 @@ public: //! Return implementation of Node interface. std::unique_ptr MakeNode(); -} // namespace interface +} // namespace interfaces -#endif // BITCOIN_INTERFACE_NODE_H +#endif // BITCOIN_INTERFACES_NODE_H diff --git a/src/interface/wallet.cpp b/src/interfaces/wallet.cpp similarity index 99% rename from src/interface/wallet.cpp rename to src/interfaces/wallet.cpp index a6bce7d3d..0244fe70f 100644 --- a/src/interface/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -2,12 +2,12 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include +#include #include #include #include -#include +#include #include #include #include @@ -24,7 +24,7 @@ #include -namespace interface { +namespace interfaces { namespace { class PendingWalletTxImpl : public PendingWalletTx @@ -283,7 +283,7 @@ public: return result; } bool tryGetTxStatus(const uint256& txid, - interface::WalletTxStatus& tx_status, + interfaces::WalletTxStatus& tx_status, int& num_blocks, int64_t& adjusted_time) override { @@ -438,4 +438,4 @@ public: std::unique_ptr MakeWallet(CWallet& wallet) { return MakeUnique(wallet); } -} // namespace interface +} // namespace interfaces diff --git a/src/interface/wallet.h b/src/interfaces/wallet.h similarity index 98% rename from src/interface/wallet.h rename to src/interfaces/wallet.h index b66ed6339..3e27242c2 100644 --- a/src/interface/wallet.h +++ b/src/interfaces/wallet.h @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef BITCOIN_INTERFACE_WALLET_H -#define BITCOIN_INTERFACE_WALLET_H +#ifndef BITCOIN_INTERFACES_WALLET_H +#define BITCOIN_INTERFACES_WALLET_H #include // For CAmount #include // For CTxDestination (CKeyID and CScriptID) @@ -27,7 +27,7 @@ class CWallet; enum class OutputType; struct CRecipient; -namespace interface { +namespace interfaces { class Handler; class PendingWalletTx; @@ -347,6 +347,6 @@ struct WalletTxOut //! in builds where ENABLE_WALLET is false. std::unique_ptr MakeWallet(CWallet& wallet); -} // namespace interface +} // namespace interfaces -#endif // BITCOIN_INTERFACE_WALLET_H +#endif // BITCOIN_INTERFACES_WALLET_H diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index a9408895d..1e3acd75c 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include @@ -74,7 +74,7 @@ public: AddressTablePriv(AddressTableModel *_parent): parent(_parent) {} - void refreshAddressTable(interface::Wallet& wallet) + void refreshAddressTable(interfaces::Wallet& wallet) { cachedAddressTable.clear(); { diff --git a/src/qt/addresstablemodel.h b/src/qt/addresstablemodel.h index 954f0f593..d7aeda9d8 100644 --- a/src/qt/addresstablemodel.h +++ b/src/qt/addresstablemodel.h @@ -13,7 +13,7 @@ enum class OutputType; class AddressTablePriv; class WalletModel; -namespace interface { +namespace interfaces { class Wallet; } diff --git a/src/qt/bantablemodel.cpp b/src/qt/bantablemodel.cpp index cbd67d70a..26cb03c2c 100644 --- a/src/qt/bantablemodel.cpp +++ b/src/qt/bantablemodel.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include @@ -46,7 +46,7 @@ public: Qt::SortOrder sortOrder; /** Pull a full list of banned nodes from CNode into our cache */ - void refreshBanlist(interface::Node& node) + void refreshBanlist(interfaces::Node& node) { banmap_t banMap; node.getBanned(banMap); @@ -82,7 +82,7 @@ public: } }; -BanTableModel::BanTableModel(interface::Node& node, ClientModel *parent) : +BanTableModel::BanTableModel(interfaces::Node& node, ClientModel *parent) : QAbstractTableModel(parent), m_node(node), clientModel(parent) diff --git a/src/qt/bantablemodel.h b/src/qt/bantablemodel.h index 4c171e6fb..d6c8dbf6d 100644 --- a/src/qt/bantablemodel.h +++ b/src/qt/bantablemodel.h @@ -15,7 +15,7 @@ class ClientModel; class BanTablePriv; -namespace interface { +namespace interfaces { class Node; } @@ -45,7 +45,7 @@ class BanTableModel : public QAbstractTableModel Q_OBJECT public: - explicit BanTableModel(interface::Node& node, ClientModel *parent = 0); + explicit BanTableModel(interfaces::Node& node, ClientModel *parent = 0); ~BanTableModel(); void startAutoRefresh(); void stopAutoRefresh(); @@ -71,7 +71,7 @@ public Q_SLOTS: void refresh(); private: - interface::Node& m_node; + interfaces::Node& m_node; ClientModel *clientModel; QStringList columns; std::unique_ptr priv; diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 30d0acb7e..db60ec988 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -27,8 +27,8 @@ #endif #include -#include -#include +#include +#include #include #include #include @@ -182,7 +182,7 @@ class BitcoinCore: public QObject { Q_OBJECT public: - explicit BitcoinCore(interface::Node& node); + explicit BitcoinCore(interfaces::Node& node); public Q_SLOTS: void initialize(); @@ -197,7 +197,7 @@ private: /// Pass fatal exception message to UI thread void handleRunawayException(const std::exception *e); - interface::Node& m_node; + interfaces::Node& m_node; }; /** Main Bitcoin application object */ @@ -205,7 +205,7 @@ class BitcoinApplication: public QApplication { Q_OBJECT public: - explicit BitcoinApplication(interface::Node& node, int &argc, char **argv); + explicit BitcoinApplication(interfaces::Node& node, int &argc, char **argv); ~BitcoinApplication(); #ifdef ENABLE_WALLET @@ -246,7 +246,7 @@ Q_SIGNALS: private: QThread *coreThread; - interface::Node& m_node; + interfaces::Node& m_node; OptionsModel *optionsModel; ClientModel *clientModel; BitcoinGUI *window; @@ -264,7 +264,7 @@ private: #include -BitcoinCore::BitcoinCore(interface::Node& node) : +BitcoinCore::BitcoinCore(interfaces::Node& node) : QObject(), m_node(node) { } @@ -304,7 +304,7 @@ void BitcoinCore::shutdown() } } -BitcoinApplication::BitcoinApplication(interface::Node& node, int &argc, char **argv): +BitcoinApplication::BitcoinApplication(interfaces::Node& node, int &argc, char **argv): QApplication(argc, argv), coreThread(0), m_node(node), @@ -535,7 +535,7 @@ int main(int argc, char *argv[]) { SetupEnvironment(); - std::unique_ptr node = interface::MakeNode(); + std::unique_ptr node = interfaces::MakeNode(); /// 1. Parse command-line options. These take precedence over anything else. // Command-line options take precedence: @@ -687,7 +687,7 @@ int main(int argc, char *argv[]) app.createOptionsModel(gArgs.GetBoolArg("-resetguisettings", false)); // Subscribe to global signals from core - std::unique_ptr handler = node->handleInitMessage(InitMessage); + std::unique_ptr handler = node->handleInitMessage(InitMessage); if (gArgs.GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && !gArgs.GetBoolArg("-min", false)) app.createSplashScreen(networkStyle.data()); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 63a2a200b..bfa8844a0 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -30,8 +30,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -74,7 +74,7 @@ const std::string BitcoinGUI::DEFAULT_UIPLATFORM = #endif ; -BitcoinGUI::BitcoinGUI(interface::Node& node, const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) : +BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) : QMainWindow(parent), enableWallet(false), m_node(node), diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 3a4b25d80..e59c71cd4 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -33,7 +33,7 @@ class WalletModel; class HelpMessageDialog; class ModalOverlay; -namespace interface { +namespace interfaces { class Handler; class Node; } @@ -56,7 +56,7 @@ class BitcoinGUI : public QMainWindow public: static const std::string DEFAULT_UIPLATFORM; - explicit BitcoinGUI(interface::Node& node, const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent = 0); + explicit BitcoinGUI(interfaces::Node& node, const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent = 0); ~BitcoinGUI(); /** Set the client model. @@ -83,9 +83,9 @@ protected: bool eventFilter(QObject *object, QEvent *event); private: - interface::Node& m_node; - std::unique_ptr m_handler_message_box; - std::unique_ptr m_handler_question; + interfaces::Node& m_node; + std::unique_ptr m_handler_message_box; + std::unique_ptr m_handler_question; ClientModel *clientModel; WalletFrame *walletFrame; diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 1dbfc815b..37fd06ccc 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -13,8 +13,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -32,7 +32,7 @@ class CBlockIndex; static int64_t nLastHeaderTipUpdateNotification = 0; static int64_t nLastBlockTipUpdateNotification = 0; -ClientModel::ClientModel(interface::Node& node, OptionsModel *_optionsModel, QObject *parent) : +ClientModel::ClientModel(interfaces::Node& node, OptionsModel *_optionsModel, QObject *parent) : QObject(parent), m_node(node), optionsModel(_optionsModel), diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 9faa10b87..a609222f7 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -17,7 +17,7 @@ class PeerTableModel; class CBlockIndex; -namespace interface { +namespace interfaces { class Handler; class Node; } @@ -46,10 +46,10 @@ class ClientModel : public QObject Q_OBJECT public: - explicit ClientModel(interface::Node& node, OptionsModel *optionsModel, QObject *parent = 0); + explicit ClientModel(interfaces::Node& node, OptionsModel *optionsModel, QObject *parent = 0); ~ClientModel(); - interface::Node& node() const { return m_node; } + interfaces::Node& node() const { return m_node; } OptionsModel *getOptionsModel(); PeerTableModel *getPeerTableModel(); BanTableModel *getBanTableModel(); @@ -75,14 +75,14 @@ public: mutable std::atomic cachedBestHeaderTime; private: - interface::Node& m_node; - std::unique_ptr m_handler_show_progress; - std::unique_ptr m_handler_notify_num_connections_changed; - std::unique_ptr m_handler_notify_network_active_changed; - std::unique_ptr m_handler_notify_alert_changed; - std::unique_ptr m_handler_banned_list_changed; - std::unique_ptr m_handler_notify_block_tip; - std::unique_ptr m_handler_notify_header_tip; + interfaces::Node& m_node; + std::unique_ptr m_handler_show_progress; + std::unique_ptr m_handler_notify_num_connections_changed; + std::unique_ptr m_handler_notify_network_active_changed; + std::unique_ptr m_handler_notify_alert_changed; + std::unique_ptr m_handler_banned_list_changed; + std::unique_ptr m_handler_notify_block_tip; + std::unique_ptr m_handler_notify_header_tip; OptionsModel *optionsModel; PeerTableModel *peerTableModel; BanTableModel *banTableModel; diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index 2081d6ca0..601a77fc8 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include #include @@ -648,7 +648,7 @@ void CoinControlDialog::updateView() int nChildren = 0; for (const auto& outpair : coins.second) { const COutPoint& output = std::get<0>(outpair); - const interface::WalletTxOut& out = std::get<1>(outpair); + const interfaces::WalletTxOut& out = std::get<1>(outpair); nSum += out.txout.nValue; nChildren++; diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 3501f9790..c76fc4ca6 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include