Changeset View
Changeset View
Standalone View
Standalone View
src/qt/transactiontablemodel.cpp
Show First 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | public: | ||||
int size() { return cachedWallet.size(); } | int size() { return cachedWallet.size(); } | ||||
TransactionRecord *index(interfaces::Wallet &wallet, | TransactionRecord *index(interfaces::Wallet &wallet, | ||||
const BlockHash &cur_block_hash, const int idx) { | const BlockHash &cur_block_hash, const int idx) { | ||||
if (idx >= 0 && idx < cachedWallet.size()) { | if (idx >= 0 && idx < cachedWallet.size()) { | ||||
TransactionRecord *rec = &cachedWallet[idx]; | TransactionRecord *rec = &cachedWallet[idx]; | ||||
// Get required locks upfront. This avoids the GUI from getting | |||||
// stuck if the core is holding the locks for a longer time - for | |||||
// example, during a wallet rescan. | |||||
// | |||||
// If a status update is needed (blocks came in since last check), | // If a status update is needed (blocks came in since last check), | ||||
// update the status of this transaction from the wallet. Otherwise, | // try to update the status of this transaction from the wallet. | ||||
// simply re-use the cached status. | // Otherwise, simply re-use the cached status. | ||||
interfaces::WalletTxStatus wtx; | interfaces::WalletTxStatus wtx; | ||||
int numBlocks; | int numBlocks; | ||||
int64_t block_time; | int64_t block_time; | ||||
if (!cur_block_hash.IsNull() && | if (!cur_block_hash.IsNull() && | ||||
rec->statusUpdateNeeded(cur_block_hash) && | rec->statusUpdateNeeded(cur_block_hash) && | ||||
wallet.tryGetTxStatus(rec->txid, wtx, numBlocks, block_time)) { | wallet.tryGetTxStatus(rec->txid, wtx, numBlocks, block_time)) { | ||||
rec->updateStatus(wtx, cur_block_hash, numBlocks, block_time); | rec->updateStatus(wtx, cur_block_hash, numBlocks, block_time); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 590 Lines • Show Last 20 Lines |