Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Jan 15, 2019

Conversation

@hebasto
Copy link
Member

@hebasto hebasto commented Oct 23, 2018

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

@MarcoFalke MarcoFalke added the GUI label Oct 23, 2018
QDateTime currentDate = QDateTime::currentDateTime();
qint64 secs = blockDate.secsTo(currentDate);

if ((secs < 90 * 60) && !wtx.is_final) {
Copy link
Contributor

@practicalswift practicalswift Oct 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 :-)

Copy link
Member Author

@hebasto hebasto Oct 23, 2018

Nice. Which file could be a proper place for this common constant?

Copy link
Contributor

@practicalswift practicalswift Oct 26, 2018

I don't know the QT code well enough to give a good recommendation here. I'll let other developers fill in :-)

Copy link
Contributor

@ken2812221 ken2812221 Oct 28, 2018

What is 90*60? How do you get this number?

Copy link
Member Author

@hebasto hebasto Oct 28, 2018

As @practicalswift mentioned above:

// Set icon state: spinning if catching up, tick otherwise
if(secs < 90*60)
{
tooltip = tr("Up to date") + QString(".<br>") + tooltip;
labelBlocksIcon->setPixmap(platformStyle->SingleColorIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));

Copy link
Member Author

@hebasto hebasto Dec 16, 2018

Ref #1026

@DrahtBot
Copy link
Contributor

@DrahtBot DrahtBot commented Oct 23, 2018

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.

@hebasto
Copy link
Member Author

@hebasto hebasto commented Nov 5, 2018

Rebased.

@hebasto hebasto force-pushed the 20181023-fix13299 branch 2 times, most recently from 7bd5c0d to ed54363 Nov 5, 2018
@hebasto hebasto force-pushed the 20181023-fix13299 branch 2 times, most recently from 1b75945 to 6da8e1e Nov 5, 2018
@jonasschnelli jonasschnelli changed the title qt: Fix bug #13299 qt fix: confirmed transaction labeled "open" (#13299) Nov 13, 2018
@hebasto
Copy link
Member Author

@hebasto hebasto commented Dec 12, 2018

Screenshots added.

@hebasto hebasto force-pushed the 20181023-fix13299 branch from 6da8e1e to e8c7f70 Dec 16, 2018
@hebasto
Copy link
Member Author

@hebasto hebasto commented Dec 16, 2018

@practicalswift @ken2812221
Your comments has been addressed.

@hebasto hebasto changed the title qt fix: confirmed transaction labeled "open" (#13299) [WIP] qt: fix confirmed transaction labeled "open" (#13299) Dec 16, 2018
@hebasto hebasto force-pushed the 20181023-fix13299 branch from e8c7f70 to 0993d1c Dec 16, 2018
@hebasto hebasto changed the title [WIP] qt: fix confirmed transaction labeled "open" (#13299) qt: fix confirmed transaction labeled "open" (#13299) Dec 16, 2018
@hebasto hebasto force-pushed the 20181023-fix13299 branch from 0993d1c to 6d97da0 Dec 17, 2018
@hebasto
Copy link
Member Author

@hebasto hebasto commented Dec 17, 2018

Rebased on top of 3e21b69.

Copy link
Member

@promag promag left a comment

Concept ACK.

if (wallet.tryGetTxStatus(rec->hash, wtx, numBlocks) && rec->statusUpdateNeeded(numBlocks)) {
rec->updateStatus(wtx, numBlocks);
if (wallet_model->wallet().tryGetTxStatus(rec->hash, wtx, numBlocks) && rec->statusUpdateNeeded(numBlocks)) {
rec->updateStatus(wtx, numBlocks, QDateTime::fromTime_t(wallet_model->node().getLastBlockTime()));
Copy link
Member

@promag promag Dec 31, 2018

Should avoid evaluating QDateTime::fromTime_t(wallet_model->node().getLastBlockTime()) for each record mostly because of excessive cs_main locks.

@@ -8,6 +8,7 @@
#include <amount.h>
#include <uint256.h>

#include <QDateTime>
Copy link
Member

@promag promag Dec 31, 2018

nit, here a forward declaration would do.

@@ -23,6 +24,8 @@ struct WalletTxStatus;
class TransactionStatus
{
public:
static constexpr int TIME_AGO_OF_LAST_BLOCK_IN_SECONDS = 90 * 60;
Copy link
Member

@promag promag Dec 31, 2018

nit, this name is kind of weird to me.

Copy link
Member Author

@hebasto hebasto Jan 2, 2019

@promag
Good naming is hard :)
Would you mind proposing a better name?

@@ -16,6 +16,7 @@
#include <qt/optionsmodel.h>
#include <qt/platformstyle.h>
#include <qt/rpcconsole.h>
#include <qt/transactionrecord.h>
Copy link
Member

@promag promag Dec 31, 2018

Maybe the constant is in the wrong place?

Copy link
Member Author

@hebasto hebasto Jan 2, 2019

Yes, this place seems inappropriate. The reason was to avoid circular dependencies.
@promag Could you point out a more appropriate place?

@hebasto hebasto force-pushed the 20181023-fix13299 branch from 6d97da0 to 26e3d8e Jan 2, 2019
Since the default `nSequence` is `0xFFFFFFFE` and locktime is enabled,
the checking `wtx.is_final` is meaningless until the syncing has
completed.
@hebasto hebasto force-pushed the 20181023-fix13299 branch from 26e3d8e to fb3ce75 Jan 2, 2019
@hebasto
Copy link
Member Author

@hebasto hebasto commented Jan 3, 2019

@promag Thank you for your review.
Your comments have been addressed. Would you mind re-reviewing?

@jonasschnelli
Copy link
Member

@jonasschnelli jonasschnelli commented Jan 4, 2019

utACK fb3ce75

1 similar comment
@laanwj
Copy link
Member

@laanwj laanwj commented Jan 15, 2019

utACK fb3ce75

@laanwj laanwj merged commit fb3ce75 into bitcoin:master Jan 15, 2019
2 checks passed
laanwj added a commit that referenced this issue Jan 15, 2019
fb3ce75 Don't label transactions "Open" while catching up (Hennadii Stepanov)

Pull request description:

  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](https://user-images.githubusercontent.com/32963518/49874288-cdd06880-fe26-11e8-8441-f3ceb479611b.png)

  With this PR (the issue has been resolved):
  ![screenshot from 2018-12-12 15-54-41](https://user-images.githubusercontent.com/32963518/49874336-e9d40a00-fe26-11e8-8c05-9aeee2eb1bba.png)

Tree-SHA512: 358ec83b43c266a4d32a37a79dda80e80d40a2b77ad38261c84a095e613399f674aa7184805b3f6310e51ddb83ae2636b8849fcc7c4333e1b3ecbb0f70ad86d3
* Maximum gap between node time and block time used
* for the "Catching up..." mode in GUI.
*
* Ref: https://github.com/bitcoin/bitcoin/pull/1026
Copy link
Member

@MarcoFalke MarcoFalke Jan 15, 2019

nit: instead of an external link you could inline the information (I guess the fp rate?)

@hebasto hebasto deleted the 20181023-fix13299 branch Jan 15, 2019
christiancfifi added a commit to christiancfifi/dash that referenced this issue Oct 3, 2021
…tcoin#13299)

fb3ce75 Don't label transactions "Open" while catching up (Hennadii Stepanov)

Pull request description:

  Fix bitcoin#13299.

  Since the default `nSequence` is `0xFFFFFFFE` and locktime is enabled, the checking `wtx.is_final` is meaningless until the syncing has completed (ref: dashpay#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](https://user-images.githubusercontent.com/32963518/49874288-cdd06880-fe26-11e8-8441-f3ceb479611b.png)

  With this PR (the issue has been resolved):
  ![screenshot from 2018-12-12 15-54-41](https://user-images.githubusercontent.com/32963518/49874336-e9d40a00-fe26-11e8-8c05-9aeee2eb1bba.png)

Tree-SHA512: 358ec83b43c266a4d32a37a79dda80e80d40a2b77ad38261c84a095e613399f674aa7184805b3f6310e51ddb83ae2636b8849fcc7c4333e1b3ecbb0f70ad86d3
christiancfifi added a commit to christiancfifi/dash that referenced this issue Oct 4, 2021
…tcoin#13299)

fb3ce75 Don't label transactions "Open" while catching up (Hennadii Stepanov)

Pull request description:

  Fix bitcoin#13299.

  Since the default `nSequence` is `0xFFFFFFFE` and locktime is enabled, the checking `wtx.is_final` is meaningless until the syncing has completed (ref: dashpay#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](https://user-images.githubusercontent.com/32963518/49874288-cdd06880-fe26-11e8-8441-f3ceb479611b.png)

  With this PR (the issue has been resolved):
  ![screenshot from 2018-12-12 15-54-41](https://user-images.githubusercontent.com/32963518/49874336-e9d40a00-fe26-11e8-8c05-9aeee2eb1bba.png)

Tree-SHA512: 358ec83b43c266a4d32a37a79dda80e80d40a2b77ad38261c84a095e613399f674aa7184805b3f6310e51ddb83ae2636b8849fcc7c4333e1b3ecbb0f70ad86d3
christiancfifi added a commit to christiancfifi/dash that referenced this issue Oct 6, 2021
…tcoin#13299)

fb3ce75 Don't label transactions "Open" while catching up (Hennadii Stepanov)

Pull request description:

  Fix bitcoin#13299.

  Since the default `nSequence` is `0xFFFFFFFE` and locktime is enabled, the checking `wtx.is_final` is meaningless until the syncing has completed (ref: dashpay#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](https://user-images.githubusercontent.com/32963518/49874288-cdd06880-fe26-11e8-8441-f3ceb479611b.png)

  With this PR (the issue has been resolved):
  ![screenshot from 2018-12-12 15-54-41](https://user-images.githubusercontent.com/32963518/49874336-e9d40a00-fe26-11e8-8c05-9aeee2eb1bba.png)

Tree-SHA512: 358ec83b43c266a4d32a37a79dda80e80d40a2b77ad38261c84a095e613399f674aa7184805b3f6310e51ddb83ae2636b8849fcc7c4333e1b3ecbb0f70ad86d3
christiancfifi added a commit to christiancfifi/dash that referenced this issue Oct 11, 2021
…tcoin#13299)

fb3ce75 Don't label transactions "Open" while catching up (Hennadii Stepanov)

Pull request description:

  Fix bitcoin#13299.

  Since the default `nSequence` is `0xFFFFFFFE` and locktime is enabled, the checking `wtx.is_final` is meaningless until the syncing has completed (ref: dashpay#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](https://user-images.githubusercontent.com/32963518/49874288-cdd06880-fe26-11e8-8441-f3ceb479611b.png)

  With this PR (the issue has been resolved):
  ![screenshot from 2018-12-12 15-54-41](https://user-images.githubusercontent.com/32963518/49874336-e9d40a00-fe26-11e8-8c05-9aeee2eb1bba.png)

Tree-SHA512: 358ec83b43c266a4d32a37a79dda80e80d40a2b77ad38261c84a095e613399f674aa7184805b3f6310e51ddb83ae2636b8849fcc7c4333e1b3ecbb0f70ad86d3
christiancfifi added a commit to christiancfifi/dash that referenced this issue Oct 14, 2021
…tcoin#13299)

fb3ce75 Don't label transactions "Open" while catching up (Hennadii Stepanov)

Pull request description:

  Fix bitcoin#13299.

  Since the default `nSequence` is `0xFFFFFFFE` and locktime is enabled, the checking `wtx.is_final` is meaningless until the syncing has completed (ref: dashpay#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](https://user-images.githubusercontent.com/32963518/49874288-cdd06880-fe26-11e8-8441-f3ceb479611b.png)

  With this PR (the issue has been resolved):
  ![screenshot from 2018-12-12 15-54-41](https://user-images.githubusercontent.com/32963518/49874336-e9d40a00-fe26-11e8-8c05-9aeee2eb1bba.png)

Tree-SHA512: 358ec83b43c266a4d32a37a79dda80e80d40a2b77ad38261c84a095e613399f674aa7184805b3f6310e51ddb83ae2636b8849fcc7c4333e1b3ecbb0f70ad86d3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

8 participants