aboutsummaryrefslogtreecommitdiff
path: root/src/qt/transactionrecord.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2018-10-23 22:02:20 +0300
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2019-01-03 00:10:24 +0200
commitfb3ce75807c50055a97f573fc72bf44d997ea218 (patch)
treeb45b48afbd769d16037d35cbc25dd6dd66e25342 /src/qt/transactionrecord.cpp
parentbfd7e5409720445b8439de20a5695b220f79f53d (diff)
downloadbitcoin-fb3ce75807c50055a97f573fc72bf44d997ea218.tar.xz
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.
Diffstat (limited to 'src/qt/transactionrecord.cpp')
-rw-r--r--src/qt/transactionrecord.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp
index d88cfe52ed..aa785553c8 100644
--- a/src/qt/transactionrecord.cpp
+++ b/src/qt/transactionrecord.cpp
@@ -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;
}