Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/wallet.cpp
Show First 20 Lines • Show All 336 Lines • ▼ Show 20 Lines | public: | ||||
in_mempool = mi->second.InMempool(); | in_mempool = mi->second.InMempool(); | ||||
order_form = mi->second.vOrderForm; | order_form = mi->second.vOrderForm; | ||||
tx_status = MakeWalletTxStatus(*locked_chain, mi->second); | tx_status = MakeWalletTxStatus(*locked_chain, mi->second); | ||||
return MakeWalletTx(*locked_chain, m_wallet, mi->second); | return MakeWalletTx(*locked_chain, m_wallet, mi->second); | ||||
} | } | ||||
return {}; | return {}; | ||||
} | } | ||||
WalletBalances getBalances() override { | WalletBalances getBalances() override { | ||||
const auto bal = m_wallet.GetBalance(); | |||||
WalletBalances result; | WalletBalances result; | ||||
result.balance = m_wallet.GetBalance(); | result.balance = bal.m_mine_trusted; | ||||
result.unconfirmed_balance = m_wallet.GetUnconfirmedBalance(); | result.unconfirmed_balance = bal.m_mine_untrusted_pending; | ||||
result.immature_balance = m_wallet.GetImmatureBalance(); | result.immature_balance = bal.m_mine_immature; | ||||
result.have_watch_only = m_wallet.HaveWatchOnly(); | result.have_watch_only = m_wallet.HaveWatchOnly(); | ||||
if (result.have_watch_only) { | if (result.have_watch_only) { | ||||
result.watch_only_balance = | result.watch_only_balance = bal.m_watchonly_trusted; | ||||
m_wallet.GetBalance(ISMINE_WATCH_ONLY); | |||||
result.unconfirmed_watch_only_balance = | result.unconfirmed_watch_only_balance = | ||||
m_wallet.GetUnconfirmedWatchOnlyBalance(); | bal.m_watchonly_untrusted_pending; | ||||
result.immature_watch_only_balance = | result.immature_watch_only_balance = bal.m_watchonly_immature; | ||||
m_wallet.GetImmatureWatchOnlyBalance(); | |||||
} | } | ||||
return result; | return result; | ||||
} | } | ||||
bool tryGetBalances(WalletBalances &balances, | bool tryGetBalances(WalletBalances &balances, | ||||
int &num_blocks) override { | int &num_blocks) override { | ||||
auto locked_chain = m_wallet.chain().lock(true /* try_lock */); | auto locked_chain = m_wallet.chain().lock(true /* try_lock */); | ||||
if (!locked_chain) { | if (!locked_chain) { | ||||
return false; | return false; | ||||
} | } | ||||
TRY_LOCK(m_wallet.cs_wallet, locked_wallet); | TRY_LOCK(m_wallet.cs_wallet, locked_wallet); | ||||
if (!locked_wallet) { | if (!locked_wallet) { | ||||
return false; | return false; | ||||
} | } | ||||
balances = getBalances(); | balances = getBalances(); | ||||
num_blocks = locked_chain->getHeight().value_or(-1); | num_blocks = locked_chain->getHeight().value_or(-1); | ||||
return true; | return true; | ||||
} | } | ||||
Amount getBalance() override { return m_wallet.GetBalance(); } | Amount getBalance() override { | ||||
return m_wallet.GetBalance().m_mine_trusted; | |||||
} | |||||
Amount getAvailableBalance(const CCoinControl &coin_control) override { | Amount getAvailableBalance(const CCoinControl &coin_control) override { | ||||
return m_wallet.GetAvailableBalance(&coin_control); | return m_wallet.GetAvailableBalance(&coin_control); | ||||
} | } | ||||
isminetype txinIsMine(const CTxIn &txin) override { | isminetype txinIsMine(const CTxIn &txin) 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); | ||||
return m_wallet.IsMine(txin); | return m_wallet.IsMine(txin); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 152 Lines • Show Last 20 Lines |