Changeset View
Changeset View
Standalone View
Standalone View
src/qt/transactionrecord.cpp
Show First 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | if (nNet > Amount::zero() || wtx.is_coinbase) { | ||||
parts.last().involvesWatchAddress = involvesWatchAddress; | parts.last().involvesWatchAddress = involvesWatchAddress; | ||||
} | } | ||||
} | } | ||||
return parts; | return parts; | ||||
} | } | ||||
void TransactionRecord::updateStatus(const interfaces::WalletTxStatus &wtx, | void TransactionRecord::updateStatus(const interfaces::WalletTxStatus &wtx, | ||||
int numBlocks, int64_t block_time) { | const BlockHash &block_hash, int numBlocks, | ||||
int64_t block_time) { | |||||
// Determine transaction status | // Determine transaction status | ||||
// Sort order, unrecorded transactions sort to the top | // Sort order, unrecorded transactions sort to the top | ||||
status.sortKey = strprintf("%010d-%01d-%010u-%03d", wtx.block_height, | status.sortKey = strprintf("%010d-%01d-%010u-%03d", wtx.block_height, | ||||
wtx.is_coinbase ? 1 : 0, wtx.time_received, idx); | wtx.is_coinbase ? 1 : 0, wtx.time_received, idx); | ||||
status.countsForBalance = wtx.is_trusted && !(wtx.blocks_to_maturity > 0); | status.countsForBalance = wtx.is_trusted && !(wtx.blocks_to_maturity > 0); | ||||
status.depth = wtx.depth_in_main_chain; | status.depth = wtx.depth_in_main_chain; | ||||
status.cur_num_blocks = numBlocks; | status.m_cur_block_hash = block_hash; | ||||
const bool up_to_date = | const bool up_to_date = | ||||
(int64_t(QDateTime::currentMSecsSinceEpoch()) / 1000 - block_time < | (int64_t(QDateTime::currentMSecsSinceEpoch()) / 1000 - block_time < | ||||
MAX_BLOCK_TIME_GAP); | MAX_BLOCK_TIME_GAP); | ||||
if (up_to_date && !wtx.is_final) { | if (up_to_date && !wtx.is_final) { | ||||
if (wtx.lock_time < LOCKTIME_THRESHOLD) { | if (wtx.lock_time < LOCKTIME_THRESHOLD) { | ||||
status.status = TransactionStatus::OpenUntilBlock; | status.status = TransactionStatus::OpenUntilBlock; | ||||
status.open_for = wtx.lock_time - numBlocks; | status.open_for = wtx.lock_time - numBlocks; | ||||
Show All 25 Lines | if (up_to_date && !wtx.is_final) { | ||||
} else if (status.depth < RecommendedNumConfirmations) { | } else if (status.depth < RecommendedNumConfirmations) { | ||||
status.status = TransactionStatus::Confirming; | status.status = TransactionStatus::Confirming; | ||||
} else { | } else { | ||||
status.status = TransactionStatus::Confirmed; | status.status = TransactionStatus::Confirmed; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
bool TransactionRecord::statusUpdateNeeded(int numBlocks) const { | bool TransactionRecord::statusUpdateNeeded(const BlockHash &block_hash) const { | ||||
return status.cur_num_blocks != numBlocks; | return status.m_cur_block_hash != block_hash; | ||||
} | } | ||||
QString TransactionRecord::getTxID() const { | QString TransactionRecord::getTxID() const { | ||||
return QString::fromStdString(txid.ToString()); | return QString::fromStdString(txid.ToString()); | ||||
} | } | ||||
int TransactionRecord::getOutputIndex() const { | int TransactionRecord::getOutputIndex() const { | ||||
return idx; | return idx; | ||||
} | } |