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

[BUG][GUI] Fix random double/triple transaction record issue #2551

Merged
merged 1 commit into from
Sep 20, 2021

Conversation

random-zebra
Copy link

@random-zebra random-zebra commented Sep 11, 2021

Should put the final nail in this coffin, allowing us to finally close #1480.

This bug is caused by the fact that, if at startup the wallet has more than 4000 (SINGLE_THREAD_MAX_TXES_SIZE) transaction records, then chachedWallet is loaded not properly ordered, therfore the binary search (used later in updateWallet, to check whether a tx is already in the model) is unreliable.

When the wallet has more than 4000 records, in fact, the list of records in TransactionTablePriv::refreshWallet() is split in batches, each one processed in a separate thread, processing the last batch in the main thread at the beginning, thus without preserving the original order (by hash) of walletTxes. Further, if the wallet has more than 200k records (MAX_AMOUNT_LOADED_RECORDS), then the list is also sorted by date before being trimmed and split in batches.

Fix this by re-sorting the cachedWallet list by hash at the end of the multi-threaded update.

@random-zebra random-zebra added this to the 5.4.0 milestone Sep 11, 2021
@random-zebra random-zebra self-assigned this Sep 11, 2021
@random-zebra random-zebra force-pushed the 202109_qt-tx_update branch 2 times, most recently from 9bf0623 to 58b3092 Compare September 11, 2021 13:45
This bug is caused by the fact that, if at startup the wallet has more
than 4000 (SINGLE_THREAD_MAX_TXES_SIZE) transaction records, then
chachedWallet is loaded not properly ordered, therfore the binary search
(used later in updateWallet, to check whether a tx is already in the
model) is unreliable.

When the wallet has more than 4000 records, in fact, the list of records
in TransactionTablePriv::refreshWallet() is split in batches, each one
processed in a separate thread, processing the last batch in the main
thread at the beginning, thus without preserving the original order (by
hash) of walletTxes. Further, if the wallet has more than 200k records
(MAX_AMOUNT_LOADED_RECORDS), then the list is also sorted by date before
being trimmed and split in batches.

Fix this by re-sorting the cachedWallet list by hash at the end of the
multi-threaded update.
x
Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finally 🍺 , tested ACK 7562b63

@random-zebra random-zebra modified the milestones: 5.4.0, 5.3.1 Sep 19, 2021
Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 7562b63

@random-zebra random-zebra merged commit 0a644d8 into PIVX-Project:master Sep 20, 2021
furszy referenced this pull request in furszy/bitcoin-core Sep 20, 2021
This bug is caused by the fact that, if at startup the wallet has more
than 4000 (SINGLE_THREAD_MAX_TXES_SIZE) transaction records, then
chachedWallet is loaded not properly ordered, therfore the binary search
(used later in updateWallet, to check whether a tx is already in the
model) is unreliable.

When the wallet has more than 4000 records, in fact, the list of records
in TransactionTablePriv::refreshWallet() is split in batches, each one
processed in a separate thread, processing the last batch in the main
thread at the beginning, thus without preserving the original order (by
hash) of walletTxes. Further, if the wallet has more than 200k records
(MAX_AMOUNT_LOADED_RECORDS), then the list is also sorted by date before
being trimmed and split in batches.

Fix this by re-sorting the cachedWallet list by hash at the end of the
multi-threaded update.
x
Github-Pull: bitcoin#2551
Rebased-From: 7562b63
Fuzzbawls added a commit that referenced this pull request Sep 21, 2021
2981a17 GUI: Remove unused, and invalid, cached QR pixmap pointer. (furszy)
798c3e9 GUI: addresses widget files overall code cleanup. (furszy)
51f6555 GUI: fix contacts list not being shown. (furszy)
5be181a [Consensus] Add checkpoints before v5.3.1 release Github-Pull: #2562 Rebased-From: e8fddd7 (random-zebra)
17fa0eb Masternode-sync: Only mark tier two messages sync requests as fulfilled if the messages are broadcast. e.g: do not mark them as fulfilled before fail for a timeout. (furszy)
2f98acf [BUG][GUI] Fix random double/triple transaction record issue (random-zebra)
754177e [BUG][TierTwo] Clear fulfilled requests when mnsync fails (random-zebra)
5a2e0d1 [Trivial] Update labelSubtitleAddress text in send widget ui Github-Pull: #2557 Rebased-From: efddb3b (random-zebra)
09b8ec0 [BUG] Spork signer doesn't persist new spork value to DB Github-Pull: #2553 Rebased-From: 5849e3e (random-zebra)
7f827e9 [Snap] Fix nightly build's genbuild.sh patch (Fuzzbawls)
24a1407 [Gitian] Ignore changes to relic_conf.h.in (Fuzzbawls)
b400640 Update manpages to reflect newer template (Fuzzbawls)
ecdbf86 [Docs] Reformat -help output for help2man (Fuzzbawls)
656be59 Run make translate to update source files (Fuzzbawls)
cd8d0b5 Stop translating command line options (Fuzzbawls)
004efe9 Stop translating remaining usages of PACKAGE_NAME (Fuzzbawls)
67e7938 Unify product name to as few places as possible (Fuzzbawls)
4fe9030 [RPC][Doc] Fix RPC/cli example in setautocombinethreshold help (random-zebra)
5f9aac4 Refactor: remove duplicated coll. confirmation check in MNModel::data Github-Pull: #2530 Rebased-From: f0fd8ac (random-zebra)
2a947c0 build: Get rid of `CLIENT_DATE` (Wladimir J. van der Laan)
51fca36 [Qt] Debug window: remove "Build date". (furszy)
d223d90 build: Remove src/obj directory from repository (Wladimir J. van der Laan)

Pull request description:

  PRs List:

  * #2525.
  * #2530.
  * #2540.
  * #2491.
  * #2541.
  * #2546.
  * #2553.
  * #2557.
  * #2559.

  Open PRs that have to get merged to be added here:

  * * [x] #2560.
  * * [x] #2555.
  * * [x] #2551.
  * * [x] #2562.

ACKs for top commit:
  random-zebra:
    ACK 2981a17
  Fuzzbawls:
    ACK 2981a17

Tree-SHA512: 400c6cd5c05c99b79c67cb0158048315f33d18a49c9606ad668727b6534c84bbbc8617eb7759b9b6fb230f8fb8b94e74902d03e1579b23b3e84d063ec7a142fa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[GUI][Visual bug] Transaction details shown TWICE.
3 participants