Skip to content

wallet: Add missing BlockUntilSyncedToCurrentChain - #22308

Merged
maflcko merged 2 commits into
bitcoin:masterfrom
maflcko:2106-wallet
Jun 22, 2021
Merged

maflcko merged 2 commits into
bitcoin:masterfrom
maflcko:2106-wallet

Conversation

@maflcko

@maflcko maflcko commented Jun 22, 2021

Copy link
Copy Markdown
Member

Fixes #20975

Also replace the wallet pointer by a reference

@maflcko maflcko added this to the 22.0 milestone Jun 22, 2021
@maflcko

maflcko commented Jun 22, 2021

Copy link
Copy Markdown
Member Author

Can be tested with:

diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp
index 1e07ff23ae..07876b7d55 100644
--- a/src/validationinterface.cpp
+++ b/src/validationinterface.cpp
@@ -8,6 +8,7 @@
 #include <chain.h>
 #include <consensus/validation.h>
 #include <logging.h>
+#include <util/time.h>
 #include <primitives/block.h>
 #include <primitives/transaction.h>
 #include <scheduler.h>
@@ -219,6 +220,7 @@ void CMainSignals::TransactionRemovedFromMempool(const CTransactionRef& tx, MemP
 
 void CMainSignals::BlockConnected(const std::shared_ptr<const CBlock> &pblock, const CBlockIndex *pindex) {
     auto event = [pblock, pindex, this] {
+        UninterruptibleSleep(100ms);
         m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.BlockConnected(pblock, pindex); });
     };
     ENQUEUE_AND_LOG_EVENT(event, "%s: block hash=%s block height=%d", __func__,

@DrahtBot

Copy link
Copy Markdown
Contributor

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

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.

@achow101

Copy link
Copy Markdown
Member

ACK fa27baa

Was able to replicate the race condition on master with the provided diff, and verified it is no longer occurring with this PR.

@maflcko
maflcko merged commit c93e123 into bitcoin:master Jun 22, 2021
@maflcko
maflcko deleted the 2106-wallet branch June 22, 2021 21:10
luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 27, 2021
gwillen pushed a commit to ElementsProject/elements that referenced this pull request Jun 1, 2022
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intermittent issue in create_raw_transaction assert_equal(final_psbt["complete"], True) fails

3 participants