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 <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 <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 <validation.h> | #include <validation.h> | ||||
#include <wallet/fees.h> | #include <wallet/fees.h> | ||||
#include <wallet/finaltx.h> | #include <wallet/finaltx.h> | ||||
#include <wallet/wallet.h> | #include <wallet/wallet.h> | ||||
#include <memory> | #include <memory> | ||||
#include <string> | |||||
#include <utility> | |||||
#include <vector> | |||||
namespace interfaces { | namespace interfaces { | ||||
namespace { | namespace { | ||||
class PendingWalletTxImpl : public PendingWalletTx { | class PendingWalletTxImpl : public PendingWalletTx { | ||||
public: | public: | ||||
PendingWalletTxImpl(CWallet &wallet) | PendingWalletTxImpl(CWallet &wallet) | ||||
: m_wallet(wallet), m_key(&wallet) {} | : m_wallet(wallet), m_key(&wallet) {} | ||||
▲ Show 20 Lines • Show All 409 Lines • ▼ Show 20 Lines | public: | ||||
const CCoinControl &coin_control) override { | const CCoinControl &coin_control) override { | ||||
return GetMinimumFee(m_wallet, tx_bytes, coin_control, g_mempool); | return GetMinimumFee(m_wallet, tx_bytes, coin_control, g_mempool); | ||||
} | } | ||||
std::shared_ptr<CWallet> m_shared_wallet; | std::shared_ptr<CWallet> m_shared_wallet; | ||||
CWallet &m_wallet; | CWallet &m_wallet; | ||||
}; | }; | ||||
class WalletClientImpl : public ChainClient { | |||||
public: | |||||
WalletClientImpl(Chain &chain, | |||||
std::vector<std::string> wallet_filenames) | |||||
: m_chain(chain), m_wallet_filenames(std::move(wallet_filenames)) {} | |||||
Chain &m_chain; | |||||
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); | ||||
} | } | ||||
std::unique_ptr<ChainClient> | |||||
MakeWalletClient(Chain &chain, std::vector<std::string> wallet_filenames) { | |||||
return std::make_unique<WalletClientImpl>(chain, | |||||
std::move(wallet_filenames)); | |||||
} | |||||
} // namespace interfaces | } // namespace interfaces |