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:
7 files changed
+27
-14
No files matched your search
@@ -28,6 +28,7 @@
|
||||
#include <qt/macdockiconhandler.h>
|
||||
#endif
|
||||
|
||||
#include <chain.h>
|
||||
#include <chainparams.h>
|
||||
#include <interfaces/handler.h>
|
||||
#include <interfaces/node.h>
|
||||
@@ -903,8 +904,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
|
||||
tooltip = tr("Processed %n block(s) of transaction history.", "", count);
|
||||
|
||||
// Set icon state: spinning if catching up, tick otherwise
|
||||
if(secs < 90*60)
|
||||
{
|
||||
if (secs < MAX_BLOCK_TIME_GAP) {
|
||||
tooltip = tr("Up to date") + QString(".<br>") + tooltip;
|
||||
labelBlocksIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
|
||||
/** Update status from core wallet tx.
|
||||
*/
|
||||
void updateStatus(const interfaces::WalletTxStatus& wtx, int numBlocks);
|
||||
void updateStatus(const interfaces::WalletTxStatus& wtx, int numBlocks, int64_t block_time);
|
||||
|
||||
/** Return whether a status update is needed.
|
||||
*/
|
||||
|
||||
@@ -193,8 +193,9 @@ public:
|
||||
// simply re-use the cached status.
|
||||
interfaces::WalletTxStatus wtx;
|
||||
int numBlocks;
|
||||
if (wallet.tryGetTxStatus(rec->hash, wtx, numBlocks) && rec->statusUpdateNeeded(numBlocks)) {
|
||||
rec->updateStatus(wtx, numBlocks);
|
||||
int64_t block_time;
|
||||
if (wallet.tryGetTxStatus(rec->hash, wtx, numBlocks, block_time) && rec->statusUpdateNeeded(numBlocks)) {
|
||||
rec->updateStatus(wtx, numBlocks, block_time);
|
||||
}
|
||||
return rec;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user