From 17780d6f35a3951f649c3b7766b9283d9c18e39f Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Sat, 7 Apr 2018 03:42:02 -0400 Subject: scripted-diff: Avoid `interface` keyword to fix windows gitian build Rename `interface` to `interfaces` Build failure reported by Chun Kuan Lee https://github.com/bitcoin/bitcoin/pull/10244#issuecomment-379434756 -BEGIN VERIFY SCRIPT- git mv src/interface src/interfaces ren() { git grep -l "$1" | xargs sed -i "s,$1,$2,g"; } ren interface/ interfaces/ ren interface:: interfaces:: ren BITCOIN_INTERFACE_ BITCOIN_INTERFACES_ ren "namespace interface" "namespace interfaces" -END VERIFY SCRIPT- --- src/Makefile.am | 12 +- src/interface/README.md | 17 -- src/interface/handler.cpp | 33 --- src/interface/handler.h | 35 --- src/interface/node.cpp | 308 -------------------------- src/interface/node.h | 259 ---------------------- src/interface/wallet.cpp | 441 ------------------------------------- src/interface/wallet.h | 352 ----------------------------- src/interfaces/README.md | 17 ++ src/interfaces/handler.cpp | 33 +++ src/interfaces/handler.h | 35 +++ src/interfaces/node.cpp | 308 ++++++++++++++++++++++++++ src/interfaces/node.h | 259 ++++++++++++++++++++++ src/interfaces/wallet.cpp | 441 +++++++++++++++++++++++++++++++++++++ src/interfaces/wallet.h | 352 +++++++++++++++++++++++++++++ src/qt/addresstablemodel.cpp | 4 +- src/qt/addresstablemodel.h | 2 +- src/qt/bantablemodel.cpp | 6 +- src/qt/bantablemodel.h | 6 +- src/qt/bitcoin.cpp | 20 +- src/qt/bitcoingui.cpp | 6 +- src/qt/bitcoingui.h | 10 +- src/qt/clientmodel.cpp | 6 +- src/qt/clientmodel.h | 22 +- src/qt/coincontroldialog.cpp | 4 +- src/qt/guiutil.cpp | 4 +- src/qt/guiutil.h | 4 +- src/qt/intro.cpp | 4 +- src/qt/intro.h | 4 +- src/qt/optionsdialog.cpp | 2 +- src/qt/optionsmodel.cpp | 4 +- src/qt/optionsmodel.h | 8 +- src/qt/overviewpage.cpp | 10 +- src/qt/overviewpage.h | 6 +- src/qt/paymentserver.cpp | 6 +- src/qt/paymentserver.h | 4 +- src/qt/peertablemodel.cpp | 8 +- src/qt/peertablemodel.h | 6 +- src/qt/rpcconsole.cpp | 12 +- src/qt/rpcconsole.h | 10 +- src/qt/sendcoinsdialog.cpp | 8 +- src/qt/sendcoinsdialog.h | 2 +- src/qt/sendcoinsentry.cpp | 2 +- src/qt/sendcoinsentry.h | 2 +- src/qt/splashscreen.cpp | 12 +- src/qt/splashscreen.h | 18 +- src/qt/test/paymentservertests.cpp | 4 +- src/qt/test/rpcnestedtests.cpp | 4 +- src/qt/test/wallettests.cpp | 4 +- src/qt/trafficgraphwidget.cpp | 2 +- src/qt/transactiondesc.cpp | 12 +- src/qt/transactiondesc.h | 6 +- src/qt/transactionrecord.cpp | 6 +- src/qt/transactionrecord.h | 6 +- src/qt/transactiontablemodel.cpp | 18 +- src/qt/transactiontablemodel.h | 6 +- src/qt/utilitydialog.cpp | 4 +- src/qt/utilitydialog.h | 4 +- src/qt/walletmodel.cpp | 10 +- src/qt/walletmodel.h | 32 +-- src/qt/walletmodeltransaction.cpp | 4 +- src/qt/walletmodeltransaction.h | 6 +- src/qt/walletview.cpp | 2 +- 63 files changed, 1627 insertions(+), 1627 deletions(-) delete mode 100644 src/interface/README.md delete mode 100644 src/interface/handler.cpp delete mode 100644 src/interface/handler.h delete mode 100644 src/interface/node.cpp delete mode 100644 src/interface/node.h delete mode 100644 src/interface/wallet.cpp delete mode 100644 src/interface/wallet.h create mode 100644 src/interfaces/README.md create mode 100644 src/interfaces/handler.cpp create mode 100644 src/interfaces/handler.h create mode 100644 src/interfaces/node.cpp create mode 100644 src/interfaces/node.h create mode 100644 src/interfaces/wallet.cpp create mode 100644 src/interfaces/wallet.h (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 605c932120..2c6ba6a6e6 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/interface/README.md deleted file mode 100644 index e93b91d23c..0000000000 --- a/src/interface/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Internal c++ interfaces - -The following interfaces are defined here: - -* [`Chain`](chain.h) — used by wallet to access blockchain and mempool state. Added in [#10973](https://github.com/bitcoin/bitcoin/pull/10973). - -* [`Chain::Client`](chain.h) — used by node to start & stop `Chain` clients. Added in [#10973](https://github.com/bitcoin/bitcoin/pull/10973). - -* [`Node`](node.h) — used by GUI to start & stop bitcoin node. Added in [#10244](https://github.com/bitcoin/bitcoin/pull/10244). - -* [`Wallet`](wallet.h) — used by GUI to access wallets. Added in [#10244](https://github.com/bitcoin/bitcoin/pull/10244). - -* [`Handler`](handler.h) — returned by `handleEvent` methods on interfaces above and used to manage lifetimes of event handlers. - -* [`Init`](init.h) — used by multiprocess code to access interfaces above on startup. Added in [#10102](https://github.com/bitcoin/bitcoin/pull/10102). - -The interfaces above define boundaries between major components of bitcoin code (node, wallet, and gui), making it possible for them to run in different processes, and be tested, developed, and understood independently. These interfaces are not currently designed to be stable or to be used externally. diff --git a/src/interface/handler.cpp b/src/interface/handler.cpp deleted file mode 100644 index 4b27f374f4..0000000000 --- a/src/interface/handler.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2018 The Bitcoin Core developers -// 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 - -namespace interface { -namespace { - -class HandlerImpl : public Handler -{ -public: - HandlerImpl(boost::signals2::connection connection) : m_connection(std::move(connection)) {} - - void disconnect() override { m_connection.disconnect(); } - - boost::signals2::scoped_connection m_connection; -}; - -} // namespace - -std::unique_ptr MakeHandler(boost::signals2::connection connection) -{ - return MakeUnique(std::move(connection)); -} - -} // namespace interface diff --git a/src/interface/handler.h b/src/interface/handler.h deleted file mode 100644 index a76334bfbf..0000000000 --- a/src/interface/handler.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2018 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_INTERFACE_HANDLER_H -#define BITCOIN_INTERFACE_HANDLER_H - -#include - -namespace boost { -namespace signals2 { -class connection; -} // namespace signals2 -} // namespace boost - -namespace interface { - -//! Generic interface for managing an event handler or callback function -//! registered with another interface. Has a single disconnect method to cancel -//! the registration and prevent any future notifications. -class Handler -{ -public: - virtual ~Handler() {} - - //! Disconnect the handler. - virtual void disconnect() = 0; -}; - -//! Return handler wrapping a boost signal connection. -std::unique_ptr MakeHandler(boost::signals2::connection connection); - -} // namespace interface - -#endif // BITCOIN_INTERFACE_HANDLER_H diff --git a/src/interface/node.cpp b/src/interface/node.cpp deleted file mode 100644 index f04da4e176..0000000000 --- a/src/interface/node.cpp +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) 2018 The Bitcoin Core developers -// 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(HAVE_CONFIG_H) -#include -#endif -#ifdef ENABLE_WALLET -#include -#include -#define CHECK_WALLET(x) x -#else -#define CHECK_WALLET(x) throw std::logic_error("Wallet function called in non-wallet build.") -#endif - -#include -#include -#include - -namespace interface { -namespace { - -class NodeImpl : public Node -{ - void parseParameters(int argc, const char* const argv[]) override - { - gArgs.ParseParameters(argc, argv); - } - void readConfigFile(const std::string& conf_path) override { gArgs.ReadConfigFile(conf_path); } - bool softSetArg(const std::string& arg, const std::string& value) override { return gArgs.SoftSetArg(arg, value); } - bool softSetBoolArg(const std::string& arg, bool value) override { return gArgs.SoftSetBoolArg(arg, value); } - void selectParams(const std::string& network) override { SelectParams(network); } - std::string getNetwork() override { return Params().NetworkIDString(); } - void initLogging() override { InitLogging(); } - void initParameterInteraction() override { InitParameterInteraction(); } - std::string getWarnings(const std::string& type) override { return GetWarnings(type); } - uint32_t getLogCategories() override { return ::logCategories; } - bool baseInitialize() override - { - return AppInitBasicSetup() && AppInitParameterInteraction() && AppInitSanityChecks() && - AppInitLockDataDirectory(); - } - bool appInitMain() override { return AppInitMain(); } - void appShutdown() override - { - Interrupt(); - Shutdown(); - } - void startShutdown() override { StartShutdown(); } - bool shutdownRequested() override { return ShutdownRequested(); } - void mapPort(bool use_upnp) override - { - if (use_upnp) { - StartMapPort(); - } else { - InterruptMapPort(); - StopMapPort(); - } - } - std::string helpMessage(HelpMessageMode mode) override { return HelpMessage(mode); } - bool getProxy(Network net, proxyType& proxy_info) override { return GetProxy(net, proxy_info); } - size_t getNodeCount(CConnman::NumConnections flags) override - { - return g_connman ? g_connman->GetNodeCount(flags) : 0; - } - bool getNodesStats(NodesStats& stats) override - { - stats.clear(); - - if (g_connman) { - std::vector stats_temp; - g_connman->GetNodeStats(stats_temp); - - stats.reserve(stats_temp.size()); - for (auto& node_stats_temp : stats_temp) { - stats.emplace_back(std::move(node_stats_temp), false, CNodeStateStats()); - } - - // Try to retrieve the CNodeStateStats for each node. - TRY_LOCK(::cs_main, lockMain); - if (lockMain) { - for (auto& node_stats : stats) { - std::get<1>(node_stats) = - GetNodeStateStats(std::get<0>(node_stats).nodeid, std::get<2>(node_stats)); - } - } - return true; - } - return false; - } - bool getBanned(banmap_t& banmap) override - { - if (g_connman) { - g_connman->GetBanned(banmap); - return true; - } - return false; - } - bool ban(const CNetAddr& net_addr, BanReason reason, int64_t ban_time_offset) override - { - if (g_connman) { - g_connman->Ban(net_addr, reason, ban_time_offset); - return true; - } - return false; - } - bool unban(const CSubNet& ip) override - { - if (g_connman) { - g_connman->Unban(ip); - return true; - } - return false; - } - bool disconnect(NodeId id) override - { - if (g_connman) { - return g_connman->DisconnectNode(id); - } - return false; - } - int64_t getTotalBytesRecv() override { return g_connman ? g_connman->GetTotalBytesRecv() : 0; } - int64_t getTotalBytesSent() override { return g_connman ? g_connman->GetTotalBytesSent() : 0; } - size_t getMempoolSize() override { return ::mempool.size(); } - size_t getMempoolDynamicUsage() override { return ::mempool.DynamicMemoryUsage(); } - bool getHeaderTip(int& height, int64_t& block_time) override - { - LOCK(::cs_main); - if (::pindexBestHeader) { - height = ::pindexBestHeader->nHeight; - block_time = ::pindexBestHeader->GetBlockTime(); - return true; - } - return false; - } - int getNumBlocks() override - { - LOCK(::cs_main); - return ::chainActive.Height(); - } - int64_t getLastBlockTime() override - { - LOCK(::cs_main); - if (::chainActive.Tip()) { - return ::chainActive.Tip()->GetBlockTime(); - } - return Params().GenesisBlock().GetBlockTime(); // Genesis block's time of current network - } - double getVerificationProgress() override - { - const CBlockIndex* tip; - { - LOCK(::cs_main); - tip = ::chainActive.Tip(); - } - return GuessVerificationProgress(Params().TxData(), tip); - } - bool isInitialBlockDownload() override { return IsInitialBlockDownload(); } - bool getReindex() override { return ::fReindex; } - bool getImporting() override { return ::fImporting; } - void setNetworkActive(bool active) override - { - if (g_connman) { - g_connman->SetNetworkActive(active); - } - } - bool getNetworkActive() override { return g_connman && g_connman->GetNetworkActive(); } - unsigned int getTxConfirmTarget() override { CHECK_WALLET(return ::nTxConfirmTarget); } - CAmount getRequiredFee(unsigned int tx_bytes) override { CHECK_WALLET(return GetRequiredFee(tx_bytes)); } - CAmount getMinimumFee(unsigned int tx_bytes, - const CCoinControl& coin_control, - int* returned_target, - FeeReason* reason) override - { - FeeCalculation fee_calc; - CAmount result; - CHECK_WALLET(result = GetMinimumFee(tx_bytes, coin_control, ::mempool, ::feeEstimator, &fee_calc)); - if (returned_target) *returned_target = fee_calc.returnedTarget; - if (reason) *reason = fee_calc.reason; - return result; - } - CAmount getMaxTxFee() override { return ::maxTxFee; } - CFeeRate estimateSmartFee(int num_blocks, bool conservative, int* returned_target = nullptr) override - { - FeeCalculation fee_calc; - CFeeRate result = ::feeEstimator.estimateSmartFee(num_blocks, &fee_calc, conservative); - if (returned_target) { - *returned_target = fee_calc.returnedTarget; - } - return result; - } - CFeeRate getDustRelayFee() override { return ::dustRelayFee; } - CFeeRate getFallbackFee() override { CHECK_WALLET(return CWallet::fallbackFee); } - CFeeRate getPayTxFee() override { CHECK_WALLET(return ::payTxFee); } - void setPayTxFee(CFeeRate rate) override { CHECK_WALLET(::payTxFee = rate); } - UniValue executeRpc(const std::string& command, const UniValue& params, const std::string& uri) override - { - JSONRPCRequest req; - req.params = params; - req.strMethod = command; - req.URI = uri; - return ::tableRPC.execute(req); - } - std::vector listRpcCommands() override { return ::tableRPC.listCommands(); } - void rpcSetTimerInterfaceIfUnset(RPCTimerInterface* iface) override { RPCSetTimerInterfaceIfUnset(iface); } - void rpcUnsetTimerInterface(RPCTimerInterface* iface) override { RPCUnsetTimerInterface(iface); } - bool getUnspentOutput(const COutPoint& output, Coin& coin) override - { - LOCK(::cs_main); - return ::pcoinsTip->GetCoin(output, coin); - } - std::vector> getWallets() override - { -#ifdef ENABLE_WALLET - std::vector> wallets; - for (CWalletRef wallet : ::vpwallets) { - wallets.emplace_back(MakeWallet(*wallet)); - } - return wallets; -#else - throw std::logic_error("Node::getWallets() called in non-wallet build."); -#endif - } - std::unique_ptr handleInitMessage(InitMessageFn fn) override - { - return MakeHandler(::uiInterface.InitMessage.connect(fn)); - } - std::unique_ptr handleMessageBox(MessageBoxFn fn) override - { - return MakeHandler(::uiInterface.ThreadSafeMessageBox.connect(fn)); - } - std::unique_ptr handleQuestion(QuestionFn fn) override - { - return MakeHandler(::uiInterface.ThreadSafeQuestion.connect(fn)); - } - std::unique_ptr handleShowProgress(ShowProgressFn fn) override - { - return MakeHandler(::uiInterface.ShowProgress.connect(fn)); - } - std::unique_ptr handleLoadWallet(LoadWalletFn fn) override - { - CHECK_WALLET( - return MakeHandler(::uiInterface.LoadWallet.connect([fn](CWallet* wallet) { fn(MakeWallet(*wallet)); }))); - } - std::unique_ptr handleNotifyNumConnectionsChanged(NotifyNumConnectionsChangedFn fn) override - { - return MakeHandler(::uiInterface.NotifyNumConnectionsChanged.connect(fn)); - } - std::unique_ptr handleNotifyNetworkActiveChanged(NotifyNetworkActiveChangedFn fn) override - { - return MakeHandler(::uiInterface.NotifyNetworkActiveChanged.connect(fn)); - } - std::unique_ptr handleNotifyAlertChanged(NotifyAlertChangedFn fn) override - { - return MakeHandler(::uiInterface.NotifyAlertChanged.connect(fn)); - } - std::unique_ptr handleBannedListChanged(BannedListChangedFn fn) override - { - return MakeHandler(::uiInterface.BannedListChanged.connect(fn)); - } - std::unique_ptr handleNotifyBlockTip(NotifyBlockTipFn fn) override - { - return MakeHandler(::uiInterface.NotifyBlockTip.connect([fn](bool initial_download, const CBlockIndex* block) { - fn(initial_download, block->nHeight, block->GetBlockTime(), - GuessVerificationProgress(Params().TxData(), block)); - })); - } - std::unique_ptr handleNotifyHeaderTip(NotifyHeaderTipFn fn) override - { - return MakeHandler( - ::uiInterface.NotifyHeaderTip.connect([fn](bool initial_download, const CBlockIndex* block) { - fn(initial_download, block->nHeight, block->GetBlockTime(), - GuessVerificationProgress(Params().TxData(), block)); - })); - } -}; - -} // namespace - -std::unique_ptr MakeNode() { return MakeUnique(); } - -} // namespace interface diff --git a/src/interface/node.h b/src/interface/node.h deleted file mode 100644 index 6ae7f9e46c..0000000000 --- a/src/interface/node.h +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright (c) 2018 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_INTERFACE_NODE_H -#define BITCOIN_INTERFACE_NODE_H - -#include // For banmap_t -#include // For CAmount -#include // For HelpMessageMode -#include // For CConnman::NumConnections -#include // For Network - -#include -#include -#include -#include -#include -#include -#include - -class CCoinControl; -class CFeeRate; -class CNodeStats; -class Coin; -class RPCTimerInterface; -class UniValue; -class proxyType; -enum class FeeReason; -struct CNodeStateStats; - -namespace interface { - -class Handler; -class Wallet; - -//! Top-level interface for a bitcoin node (bitcoind process). -class Node -{ -public: - virtual ~Node() {} - - //! Set command line arguments. - virtual void parseParameters(int argc, const char* const argv[]) = 0; - - //! Set a command line argument if it doesn't already have a value - virtual bool softSetArg(const std::string& arg, const std::string& value) = 0; - - //! Set a command line boolean argument if it doesn't already have a value - virtual bool softSetBoolArg(const std::string& arg, bool value) = 0; - - //! Load settings from configuration file. - virtual void readConfigFile(const std::string& conf_path) = 0; - - //! Choose network parameters. - virtual void selectParams(const std::string& network) = 0; - - //! Get network name. - virtual std::string getNetwork() = 0; - - //! Init logging. - virtual void initLogging() = 0; - - //! Init parameter interaction. - virtual void initParameterInteraction() = 0; - - //! Get warnings. - virtual std::string getWarnings(const std::string& type) = 0; - - // Get log flags. - virtual uint32_t getLogCategories() = 0; - - //! Initialize app dependencies. - virtual bool baseInitialize() = 0; - - //! Start node. - virtual bool appInitMain() = 0; - - //! Stop node. - virtual void appShutdown() = 0; - - //! Start shutdown. - virtual void startShutdown() = 0; - - //! Return whether shutdown was requested. - virtual bool shutdownRequested() = 0; - - //! Get help message string. - virtual std::string helpMessage(HelpMessageMode mode) = 0; - - //! Map port. - virtual void mapPort(bool use_upnp) = 0; - - //! Get proxy. - virtual bool getProxy(Network net, proxyType& proxy_info) = 0; - - //! Get number of connections. - virtual size_t getNodeCount(CConnman::NumConnections flags) = 0; - - //! Get stats for connected nodes. - using NodesStats = std::vector>; - virtual bool getNodesStats(NodesStats& stats) = 0; - - //! Get ban map entries. - virtual bool getBanned(banmap_t& banmap) = 0; - - //! Ban node. - virtual bool ban(const CNetAddr& net_addr, BanReason reason, int64_t ban_time_offset) = 0; - - //! Unban node. - virtual bool unban(const CSubNet& ip) = 0; - - //! Disconnect node. - virtual bool disconnect(NodeId id) = 0; - - //! Get total bytes recv. - virtual int64_t getTotalBytesRecv() = 0; - - //! Get total bytes sent. - virtual int64_t getTotalBytesSent() = 0; - - //! Get mempool size. - virtual size_t getMempoolSize() = 0; - - //! Get mempool dynamic usage. - virtual size_t getMempoolDynamicUsage() = 0; - - //! Get header tip height and time. - virtual bool getHeaderTip(int& height, int64_t& block_time) = 0; - - //! Get num blocks. - virtual int getNumBlocks() = 0; - - //! Get last block time. - virtual int64_t getLastBlockTime() = 0; - - //! Get verification progress. - virtual double getVerificationProgress() = 0; - - //! Is initial block download. - virtual bool isInitialBlockDownload() = 0; - - //! Get reindex. - virtual bool getReindex() = 0; - - //! Get importing. - virtual bool getImporting() = 0; - - //! Set network active. - virtual void setNetworkActive(bool active) = 0; - - //! Get network active. - virtual bool getNetworkActive() = 0; - - //! Get tx confirm target. - virtual unsigned int getTxConfirmTarget() = 0; - - //! Get required fee. - virtual CAmount getRequiredFee(unsigned int tx_bytes) = 0; - - //! Get minimum fee. - virtual CAmount getMinimumFee(unsigned int tx_bytes, - const CCoinControl& coin_control, - int* returned_target, - FeeReason* reason) = 0; - - //! Get max tx fee. - virtual CAmount getMaxTxFee() = 0; - - //! Estimate smart fee. - virtual CFeeRate estimateSmartFee(int num_blocks, bool conservative, int* returned_target = nullptr) = 0; - - //! Get dust relay fee. - virtual CFeeRate getDustRelayFee() = 0; - - //! Get fallback fee. - virtual CFeeRate getFallbackFee() = 0; - - //! Get pay tx fee. - virtual CFeeRate getPayTxFee() = 0; - - //! Set pay tx fee. - virtual void setPayTxFee(CFeeRate rate) = 0; - - //! Execute rpc command. - virtual UniValue executeRpc(const std::string& command, const UniValue& params, const std::string& uri) = 0; - - //! List rpc commands. - virtual std::vector listRpcCommands() = 0; - - //! Set RPC timer interface if unset. - virtual void rpcSetTimerInterfaceIfUnset(RPCTimerInterface* iface) = 0; - - //! Unset RPC timer interface. - virtual void rpcUnsetTimerInterface(RPCTimerInterface* iface) = 0; - - //! Get unspent outputs associated with a transaction. - virtual bool getUnspentOutput(const COutPoint& output, Coin& coin) = 0; - - //! Return interfaces for accessing wallets (if any). - virtual std::vector> getWallets() = 0; - - //! Register handler for init messages. - using InitMessageFn = std::function; - virtual std::unique_ptr handleInitMessage(InitMessageFn fn) = 0; - - //! Register handler for message box messages. - using MessageBoxFn = - std::function; - virtual std::unique_ptr handleMessageBox(MessageBoxFn fn) = 0; - - //! Register handler for question messages. - using QuestionFn = std::function; - virtual std::unique_ptr handleQuestion(QuestionFn fn) = 0; - - //! Register handler for progress messages. - using ShowProgressFn = std::function; - virtual std::unique_ptr handleShowProgress(ShowProgressFn fn) = 0; - - //! Register handler for load wallet messages. - using LoadWalletFn = std::function wallet)>; - virtual std::unique_ptr handleLoadWallet(LoadWalletFn fn) = 0; - - //! Register handler for number of connections changed messages. - using NotifyNumConnectionsChangedFn = std::function; - virtual std::unique_ptr handleNotifyNumConnectionsChanged(NotifyNumConnectionsChangedFn fn) = 0; - - //! Register handler for network active messages. - using NotifyNetworkActiveChangedFn = std::function; - virtual std::unique_ptr handleNotifyNetworkActiveChanged(NotifyNetworkActiveChangedFn fn) = 0; - - //! Register handler for notify alert messages. - using NotifyAlertChangedFn = std::function; - virtual std::unique_ptr handleNotifyAlertChanged(NotifyAlertChangedFn fn) = 0; - - //! Register handler for ban list messages. - using BannedListChangedFn = std::function; - virtual std::unique_ptr handleBannedListChanged(BannedListChangedFn fn) = 0; - - //! Register handler for block tip messages. - using NotifyBlockTipFn = - std::function; - virtual std::unique_ptr handleNotifyBlockTip(NotifyBlockTipFn fn) = 0; - - //! Register handler for header tip messages. - using NotifyHeaderTipFn = - std::function; - virtual std::unique_ptr handleNotifyHeaderTip(NotifyHeaderTipFn fn) = 0; -}; - -//! Return implementation of Node interface. -std::unique_ptr MakeNode(); - -} // namespace interface - -#endif // BITCOIN_INTERFACE_NODE_H diff --git a/src/interface/wallet.cpp b/src/interface/wallet.cpp deleted file mode 100644 index a6bce7d3de..0000000000 --- a/src/interface/wallet.cpp +++ /dev/null @@ -1,441 +0,0 @@ -// Copyright (c) 2018 The Bitcoin Core developers -// 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