Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/wallet.cpp
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | public: | ||||
} | } | ||||
CTransactionRef m_tx; | CTransactionRef m_tx; | ||||
CWallet &m_wallet; | CWallet &m_wallet; | ||||
CReserveKey m_key; | CReserveKey m_key; | ||||
}; | }; | ||||
//! Construct wallet tx struct. | //! Construct wallet tx struct. | ||||
WalletTx MakeWalletTx(CWallet &wallet, const CWalletTx &wtx) { | static WalletTx MakeWalletTx(CWallet &wallet, const CWalletTx &wtx) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | |||||
WalletTx result; | WalletTx result; | ||||
result.tx = wtx.tx; | result.tx = wtx.tx; | ||||
result.txin_is_mine.reserve(wtx.tx->vin.size()); | result.txin_is_mine.reserve(wtx.tx->vin.size()); | ||||
for (const auto &txin : wtx.tx->vin) { | for (const auto &txin : wtx.tx->vin) { | ||||
result.txin_is_mine.emplace_back(wallet.IsMine(txin)); | result.txin_is_mine.emplace_back(wallet.IsMine(txin)); | ||||
} | } | ||||
result.txout_is_mine.reserve(wtx.tx->vout.size()); | result.txout_is_mine.reserve(wtx.tx->vout.size()); | ||||
result.txout_address.reserve(wtx.tx->vout.size()); | result.txout_address.reserve(wtx.tx->vout.size()); | ||||
Show All 12 Lines | static WalletTx MakeWalletTx(CWallet &wallet, const CWalletTx &wtx) | ||||
result.change = wtx.GetChange(); | result.change = wtx.GetChange(); | ||||
result.time = wtx.GetTxTime(); | result.time = wtx.GetTxTime(); | ||||
result.value_map = wtx.mapValue; | result.value_map = wtx.mapValue; | ||||
result.is_coinbase = wtx.IsCoinBase(); | result.is_coinbase = wtx.IsCoinBase(); | ||||
return result; | return result; | ||||
} | } | ||||
//! Construct wallet tx status struct. | //! Construct wallet tx status struct. | ||||
WalletTxStatus MakeWalletTxStatus(const CWalletTx &wtx) { | static WalletTxStatus MakeWalletTxStatus(const CWalletTx &wtx) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | |||||
WalletTxStatus result; | WalletTxStatus result; | ||||
CBlockIndex *block = LookupBlockIndex(wtx.hashBlock); | CBlockIndex *block = LookupBlockIndex(wtx.hashBlock); | ||||
result.block_height = | result.block_height = | ||||
(block ? block->nHeight : std::numeric_limits<int>::max()), | (block ? block->nHeight : std::numeric_limits<int>::max()), | ||||
result.blocks_to_maturity = wtx.GetBlocksToMaturity(); | result.blocks_to_maturity = wtx.GetBlocksToMaturity(); | ||||
result.depth_in_main_chain = wtx.GetDepthInMainChain(); | result.depth_in_main_chain = wtx.GetDepthInMainChain(); | ||||
result.time_received = wtx.nTimeReceived; | result.time_received = wtx.nTimeReceived; | ||||
result.lock_time = wtx.tx->nLockTime; | result.lock_time = wtx.tx->nLockTime; | ||||
result.is_final = CheckFinalTx(*wtx.tx); | result.is_final = CheckFinalTx(*wtx.tx); | ||||
result.is_trusted = wtx.IsTrusted(); | result.is_trusted = wtx.IsTrusted(); | ||||
result.is_abandoned = wtx.isAbandoned(); | result.is_abandoned = wtx.isAbandoned(); | ||||
result.is_coinbase = wtx.IsCoinBase(); | result.is_coinbase = wtx.IsCoinBase(); | ||||
result.is_in_main_chain = wtx.IsInMainChain(); | result.is_in_main_chain = wtx.IsInMainChain(); | ||||
return result; | return result; | ||||
} | } | ||||
//! Construct wallet TxOut struct. | //! Construct wallet TxOut struct. | ||||
WalletTxOut MakeWalletTxOut(CWallet &wallet, const CWalletTx &wtx, int n, | static WalletTxOut MakeWalletTxOut(CWallet &wallet, const CWalletTx &wtx, | ||||
int depth) { | int n, int depth) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | |||||
WalletTxOut result; | WalletTxOut result; | ||||
result.txout = wtx.tx->vout[n]; | result.txout = wtx.tx->vout[n]; | ||||
result.time = wtx.GetTxTime(); | result.time = wtx.GetTxTime(); | ||||
result.depth_in_main_chain = depth; | result.depth_in_main_chain = depth; | ||||
result.is_spent = wallet.IsSpent(COutPoint(wtx.GetId(), n)); | result.is_spent = wallet.IsSpent(COutPoint(wtx.GetId(), n)); | ||||
return result; | return result; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 326 Lines • Show Last 20 Lines |