Don't label transactions "Open" while catching up

Since the default `nSequence` is `0xFFFFFFFE` and locktime is enabled,
the checking `wtx.is_final` is meaningless until the syncing has
completed.
This commit is contained in:
Hennadii Stepanov
2018-10-23 22:02:20 +03:00
parent bfd7e54097
commit fb3ce75807
7 changed files with 27 additions and 14 deletions

View File

@@ -4,6 +4,7 @@
#include <qt/transactionrecord.h>
#include <chain.h>
#include <consensus/consensus.h>
#include <interfaces/wallet.h>
#include <key_io.h>
@@ -12,6 +13,7 @@
#include <stdint.h>
#include <QDateTime>
/* Return positive answer if transaction should be shown in list.
*/
@@ -158,7 +160,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
return parts;
}
void TransactionRecord::updateStatus(const interfaces::WalletTxStatus& wtx, int numBlocks)
void TransactionRecord::updateStatus(const interfaces::WalletTxStatus& wtx, int numBlocks, int64_t block_time)
{
// Determine transaction status
@@ -172,10 +174,9 @@ void TransactionRecord::updateStatus(const interfaces::WalletTxStatus& wtx, int
status.depth = wtx.depth_in_main_chain;
status.cur_num_blocks = numBlocks;
if (!wtx.is_final)
{
if (wtx.lock_time < LOCKTIME_THRESHOLD)
{
const bool up_to_date = ((int64_t)QDateTime::currentMSecsSinceEpoch() / 1000 - block_time < MAX_BLOCK_TIME_GAP);
if (up_to_date && !wtx.is_final) {
if (wtx.lock_time < LOCKTIME_THRESHOLD) {
status.status = TransactionStatus::OpenUntilBlock;
status.open_for = wtx.lock_time - numBlocks;
}