Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/wallet.cpp
Show All 35 Lines | |||||
#include <utility> | #include <utility> | ||||
#include <vector> | #include <vector> | ||||
namespace interfaces { | namespace interfaces { | ||||
namespace { | namespace { | ||||
class PendingWalletTxImpl : public PendingWalletTx { | class PendingWalletTxImpl : public PendingWalletTx { | ||||
public: | public: | ||||
PendingWalletTxImpl(CWallet &wallet) | explicit PendingWalletTxImpl(CWallet &wallet) | ||||
: m_wallet(wallet), m_key(&wallet) {} | : m_wallet(wallet), m_key(&wallet) {} | ||||
const CTransaction &get() override { return *m_tx; } | const CTransaction &get() override { return *m_tx; } | ||||
bool commit(WalletValueMap value_map, WalletOrderForm order_form, | bool commit(WalletValueMap value_map, WalletOrderForm order_form, | ||||
std::string &reject_reason) override { | std::string &reject_reason) override { | ||||
auto locked_chain = m_wallet.chain().lock(); | auto locked_chain = m_wallet.chain().lock(); | ||||
LOCK(m_wallet.cs_wallet); | LOCK(m_wallet.cs_wallet); | ||||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | static WalletTxOut MakeWalletTxOut(interfaces::Chain::Lock &locked_chain, | ||||
result.depth_in_main_chain = depth; | result.depth_in_main_chain = depth; | ||||
result.is_spent = | result.is_spent = | ||||
wallet.IsSpent(locked_chain, COutPoint(wtx.GetId(), n)); | wallet.IsSpent(locked_chain, COutPoint(wtx.GetId(), n)); | ||||
return result; | return result; | ||||
} | } | ||||
class WalletImpl : public Wallet { | class WalletImpl : public Wallet { | ||||
public: | public: | ||||
WalletImpl(const std::shared_ptr<CWallet> &wallet) | explicit WalletImpl(const std::shared_ptr<CWallet> &wallet) | ||||
: m_shared_wallet(wallet), m_wallet(*wallet.get()) {} | : m_shared_wallet(wallet), m_wallet(*wallet.get()) {} | ||||
bool encryptWallet(const SecureString &wallet_passphrase) override { | bool encryptWallet(const SecureString &wallet_passphrase) override { | ||||
return m_wallet.EncryptWallet(wallet_passphrase); | return m_wallet.EncryptWallet(wallet_passphrase); | ||||
} | } | ||||
bool isCrypted() override { return m_wallet.IsCrypted(); } | bool isCrypted() override { return m_wallet.IsCrypted(); } | ||||
bool lock() override { return m_wallet.Lock(); } | bool lock() override { return m_wallet.Lock(); } | ||||
bool unlock(const SecureString &wallet_passphrase) override { | bool unlock(const SecureString &wallet_passphrase) override { | ||||
▲ Show 20 Lines • Show All 388 Lines • Show Last 20 Lines |