qt: fix confirmed transaction labeled “open” (#13299) #14556

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:20181023-fix13299 changing 7 files +27 −14
  1. hebasto commented at 7:29 pm on October 23, 2018: member

    Fix #13299.

    Since the default nSequence is 0xFFFFFFFE and locktime is enabled, the checking wtx.is_final is meaningless until the syncing has completed (ref: #1026).

    This PR makes the wallet mark a transaction “Unconfirmed” instead of misleading “Open for NNN more blocks” when syncing after a period of being offline.

    Before this PR (with the issue): screenshot from 2018-12-12 15-56-23

    With this PR (the issue has been resolved): screenshot from 2018-12-12 15-54-41

  2. MarcoFalke added the label GUI on Oct 23, 2018
  3. in src/qt/transactionrecord.cpp:178 in d462446e1c outdated
    179-        if (wtx.lock_time < LOCKTIME_THRESHOLD)
    180-        {
    181+    QDateTime currentDate = QDateTime::currentDateTime();
    182+    qint64 secs = blockDate.secsTo(currentDate);
    183+
    184+    if ((secs < 90 * 60) && !wtx.is_final) {
    


    practicalswift commented at 8:54 pm on October 23, 2018:
    90 * 60 here is meant to match the if(secs < 90*60) in src/qt/bitcoingui.cpp, right? If so, I suggest adding a common constant to make sure these values stay in sync over time :-)

    hebasto commented at 9:07 pm on October 23, 2018:
    Nice. Which file could be a proper place for this common constant?

    practicalswift commented at 7:52 am on October 26, 2018:
    I don’t know the QT code well enough to give a good recommendation here. I’ll let other developers fill in :-)

    ken2812221 commented at 3:39 pm on October 28, 2018:
    What is 90*60? How do you get this number?


    hebasto commented at 9:11 pm on December 16, 2018:
    Ref #1026
  4. DrahtBot commented at 9:57 pm on October 23, 2018: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #14711 (Remove uses of chainActive and mapBlockIndex in wallet code by ryanofsky)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  5. DrahtBot added the label Needs rebase on Nov 5, 2018
  6. hebasto force-pushed on Nov 5, 2018
  7. hebasto commented at 12:39 pm on November 5, 2018: member
    Rebased.
  8. hebasto force-pushed on Nov 5, 2018
  9. hebasto force-pushed on Nov 5, 2018
  10. DrahtBot removed the label Needs rebase on Nov 5, 2018
  11. hebasto force-pushed on Nov 5, 2018
  12. hebasto force-pushed on Nov 5, 2018
  13. jonasschnelli renamed this:
    qt: Fix bug #13299
    qt fix: confirmed transaction labeled "open" (#13299)
    on Nov 13, 2018
  14. hebasto commented at 2:01 pm on December 12, 2018: member
    Screenshots added.
  15. hebasto force-pushed on Dec 16, 2018
  16. hebasto commented at 9:59 pm on December 16, 2018: member
    @practicalswift @ken2812221 Your comments has been addressed.
  17. hebasto renamed this:
    qt fix: confirmed transaction labeled "open" (#13299)
    [WIP] qt: fix confirmed transaction labeled "open" (#13299)
    on Dec 16, 2018
  18. hebasto force-pushed on Dec 16, 2018
  19. hebasto renamed this:
    [WIP] qt: fix confirmed transaction labeled "open" (#13299)
    qt: fix confirmed transaction labeled "open" (#13299)
    on Dec 16, 2018
  20. hebasto force-pushed on Dec 17, 2018
  21. hebasto commented at 1:20 pm on December 17, 2018: member
    Rebased on top of 3e21b690d1aedb73a7dc2bc5d2ff1b011b52d927.
  22. in src/qt/transactiontablemodel.cpp:196 in 6d97da08c5 outdated
    191@@ -193,8 +192,8 @@ class TransactionTablePriv
    192             // simply re-use the cached status.
    193             interfaces::WalletTxStatus wtx;
    194             int numBlocks;
    195-            if (wallet.tryGetTxStatus(rec->hash, wtx, numBlocks) && rec->statusUpdateNeeded(numBlocks)) {
    196-                rec->updateStatus(wtx, numBlocks);
    197+            if (wallet_model->wallet().tryGetTxStatus(rec->hash, wtx, numBlocks) && rec->statusUpdateNeeded(numBlocks)) {
    198+                rec->updateStatus(wtx, numBlocks, QDateTime::fromTime_t(wallet_model->node().getLastBlockTime()));
    


    promag commented at 0:48 am on December 31, 2018:
    Should avoid evaluating QDateTime::fromTime_t(wallet_model->node().getLastBlockTime()) for each record mostly because of excessive cs_main locks.
  23. in src/qt/transactionrecord.h:11 in 6d97da08c5 outdated
     7@@ -8,6 +8,7 @@
     8 #include <amount.h>
     9 #include <uint256.h>
    10 
    11+#include <QDateTime>
    


    promag commented at 0:49 am on December 31, 2018:
    nit, here a forward declaration would do.
  24. in src/qt/transactionrecord.h:27 in 6d97da08c5 outdated
    23@@ -23,6 +24,8 @@ struct WalletTxStatus;
    24 class TransactionStatus
    25 {
    26 public:
    27+    static constexpr int TIME_AGO_OF_LAST_BLOCK_IN_SECONDS = 90 * 60;
    


    promag commented at 0:52 am on December 31, 2018:
    nit, this name is kind of weird to me.

    hebasto commented at 7:31 am on January 2, 2019:
    @promag Good naming is hard :) Would you mind proposing a better name?
  25. in src/qt/bitcoingui.cpp:19 in 6d97da08c5 outdated
    15@@ -16,6 +16,7 @@
    16 #include <qt/optionsmodel.h>
    17 #include <qt/platformstyle.h>
    18 #include <qt/rpcconsole.h>
    19+#include <qt/transactionrecord.h>
    


    promag commented at 0:53 am on December 31, 2018:
    Maybe the constant is in the wrong place?

    hebasto commented at 7:36 am on January 2, 2019:
    Yes, this place seems inappropriate. The reason was to avoid circular dependencies. @promag Could you point out a more appropriate place?
  26. promag commented at 0:54 am on December 31, 2018: member
    Concept ACK.
  27. hebasto force-pushed on Jan 2, 2019
  28. 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.
    fb3ce75807
  29. hebasto force-pushed on Jan 2, 2019
  30. hebasto commented at 7:30 am on January 3, 2019: member
    @promag Thank you for your review. Your comments have been addressed. Would you mind re-reviewing?
  31. jonasschnelli commented at 6:18 am on January 4, 2019: contributor
    utACK fb3ce75807c50055a97f573fc72bf44d997ea218
  32. laanwj commented at 4:38 pm on January 15, 2019: member
    utACK fb3ce75807c50055a97f573fc72bf44d997ea218
  33. laanwj merged this on Jan 15, 2019
  34. laanwj closed this on Jan 15, 2019

  35. laanwj referenced this in commit e8ad580f51 on Jan 15, 2019
  36. in src/chain.h:35 in fb3ce75807
    32+
    33+/**
    34+ * Maximum gap between node time and block time used
    35+ * for the "Catching up..." mode in GUI.
    36+ *
    37+ * Ref: https://github.com/bitcoin/bitcoin/pull/1026
    


    MarcoFalke commented at 4:45 pm on January 15, 2019:
    nit: instead of an external link you could inline the information (I guess the fp rate?)
  37. hebasto deleted the branch on Jan 15, 2019
  38. christiancfifi referenced this in commit 62f607c4ca on Oct 3, 2021
  39. christiancfifi referenced this in commit 5945e27855 on Oct 4, 2021
  40. christiancfifi referenced this in commit 2feead760f on Oct 6, 2021
  41. christiancfifi referenced this in commit 094b8736c0 on Oct 11, 2021
  42. christiancfifi referenced this in commit 5fb15a98aa on Oct 14, 2021
  43. pravblockc referenced this in commit 04c3e5f583 on Nov 18, 2021
  44. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me