Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/wallet.cpp
// Copyright (c) 2018 The Bitcoin Core developers | // Copyright (c) 2018 The Bitcoin Core developers | ||||
// 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 <interfaces/wallet.h> | #include <interfaces/wallet.h> | ||||
#include <amount.h> | #include <amount.h> | ||||
#include <chain.h> | #include <chain.h> | ||||
#include <consensus/validation.h> | #include <consensus/validation.h> | ||||
#include <init.h> | |||||
#include <interfaces/chain.h> | #include <interfaces/chain.h> | ||||
#include <interfaces/handler.h> | #include <interfaces/handler.h> | ||||
#include <net.h> | #include <net.h> | ||||
#include <policy/fees.h> | #include <policy/fees.h> | ||||
#include <policy/policy.h> | #include <policy/policy.h> | ||||
#include <primitives/transaction.h> | #include <primitives/transaction.h> | ||||
#include <rpc/server.h> | |||||
#include <scheduler.h> | |||||
#include <script/ismine.h> | #include <script/ismine.h> | ||||
#include <script/standard.h> | #include <script/standard.h> | ||||
#include <support/allocators/secure.h> | #include <support/allocators/secure.h> | ||||
#include <sync.h> | #include <sync.h> | ||||
#include <timedata.h> | #include <timedata.h> | ||||
#include <ui_interface.h> | #include <ui_interface.h> | ||||
#include <util/system.h> | #include <util/system.h> | ||||
#include <validation.h> | #include <validation.h> | ||||
#include <wallet/fees.h> | #include <wallet/fees.h> | ||||
#include <wallet/finaltx.h> | #include <wallet/finaltx.h> | ||||
#include <wallet/rpcdump.h> | |||||
#include <wallet/rpcwallet.h> | |||||
#include <wallet/wallet.h> | #include <wallet/wallet.h> | ||||
#include <wallet/walletutil.h> | |||||
#include <memory> | #include <memory> | ||||
#include <string> | #include <string> | ||||
#include <utility> | #include <utility> | ||||
#include <vector> | #include <vector> | ||||
namespace interfaces { | namespace interfaces { | ||||
namespace { | namespace { | ||||
▲ Show 20 Lines • Show All 446 Lines • ▼ Show 20 Lines | namespace { | ||||
}; | }; | ||||
class WalletClientImpl : public ChainClient { | class WalletClientImpl : public ChainClient { | ||||
public: | public: | ||||
WalletClientImpl(Chain &chain, | WalletClientImpl(Chain &chain, | ||||
std::vector<std::string> wallet_filenames) | std::vector<std::string> wallet_filenames) | ||||
: m_chain(chain), m_wallet_filenames(std::move(wallet_filenames)) {} | : m_chain(chain), m_wallet_filenames(std::move(wallet_filenames)) {} | ||||
void registerRpcs() override { | |||||
RegisterWalletRPCCommands(::tableRPC); | |||||
RegisterDumpRPCCommands(::tableRPC); | |||||
} | |||||
bool verify(const CChainParams &chainParams) override { | |||||
return VerifyWallets(chainParams, m_chain, m_wallet_filenames); | |||||
} | |||||
bool load(const CChainParams &chainParams) override { | |||||
return LoadWallets(chainParams, m_chain, m_wallet_filenames); | |||||
} | |||||
void start(CScheduler &scheduler) override { | |||||
return StartWallets(scheduler); | |||||
} | |||||
void flush() override { return FlushWallets(); } | |||||
void stop() override { return StopWallets(); } | |||||
~WalletClientImpl() override { UnloadWallets(); } | |||||
Chain &m_chain; | Chain &m_chain; | ||||
std::vector<std::string> m_wallet_filenames; | std::vector<std::string> m_wallet_filenames; | ||||
}; | }; | ||||
} // namespace | } // namespace | ||||
std::unique_ptr<Wallet> MakeWallet(const std::shared_ptr<CWallet> &wallet) { | std::unique_ptr<Wallet> MakeWallet(const std::shared_ptr<CWallet> &wallet) { | ||||
return std::make_unique<WalletImpl>(wallet); | return std::make_unique<WalletImpl>(wallet); | ||||
Show All 9 Lines |