forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
backport: bitcoin#18160, #18454, #18487, #18524, #18532, #18546, #18551, #18561, #18563, #18587 #5479
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
Merged
Merged
backport: bitcoin#18160, #18454, #18487, #18524, #18532, #18546, #18551, #18561, #18563, #18587 #5479
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9a84f7e
Merge #18160: gui: Avoid Wallet::GetBalance in WalletModel::pollBalan…
laanwj 4f00d45
Merge #18587: gui: Avoid wallet tryGetBalances calls in WalletModel::…
knst d2bbf03
Merge #18524: refactor: drop boost::signals2 in validationinterface
laanwj 76242f9
Merge #18551: Do not clear validationinterface entries being executed
363b37d
Merge #18487: rpc: Fix rpcRunLater race in walletpassphrase
laanwj 2046ae1
Merge #18546: Bugfix: Wallet: Safely deal with change in the address …
560e558
Merge #18532: rpc: Avoid initialization-order-fiasco on static CRPCCo…
7c5f9af
Merge #18563: test: Fix unregister_all_during_call cleanup
5460866
Merge #18561: test: Properly raise FailedToStartError when rpc shutdo…
2c9d41d
Merge #18454: net: Make addr relay mockable, add test
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| // Copyright (c) 2020 The Bitcoin Core developers | ||
| // Distributed under the MIT software license, see the accompanying | ||
| // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
|
||
| #include <boost/test/unit_test.hpp> | ||
| #include <consensus/validation.h> | ||
| #include <primitives/block.h> | ||
| #include <scheduler.h> | ||
| #include <test/util/setup_common.h> | ||
| #include <util/check.h> | ||
| #include <validationinterface.h> | ||
|
|
||
| BOOST_FIXTURE_TEST_SUITE(validationinterface_tests, TestingSetup) | ||
|
|
||
| class TestInterface : public CValidationInterface | ||
| { | ||
| public: | ||
| TestInterface(std::function<void()> on_call = nullptr, std::function<void()> on_destroy = nullptr) | ||
| : m_on_call(std::move(on_call)), m_on_destroy(std::move(on_destroy)) | ||
| { | ||
| } | ||
| virtual ~TestInterface() | ||
| { | ||
| if (m_on_destroy) m_on_destroy(); | ||
| } | ||
| void BlockChecked(const CBlock& block, const BlockValidationState& state) override | ||
| { | ||
| if (m_on_call) m_on_call(); | ||
| } | ||
| static void Call() | ||
| { | ||
| CBlock block; | ||
| BlockValidationState state; | ||
| GetMainSignals().BlockChecked(block, state); | ||
| } | ||
| std::function<void()> m_on_call; | ||
| std::function<void()> m_on_destroy; | ||
| }; | ||
|
|
||
| // Regression test to ensure UnregisterAllValidationInterfaces calls don't | ||
| // destroy a validation interface while it is being called. Bug: | ||
| // https://github.com/bitcoin/bitcoin/pull/18551 | ||
| BOOST_AUTO_TEST_CASE(unregister_all_during_call) | ||
| { | ||
| bool destroyed = false; | ||
| RegisterSharedValidationInterface(std::make_shared<TestInterface>( | ||
| [&] { | ||
| // First call should decrements reference count 2 -> 1 | ||
| UnregisterAllValidationInterfaces(); | ||
| BOOST_CHECK(!destroyed); | ||
| // Second call should not decrement reference count 1 -> 0 | ||
| UnregisterAllValidationInterfaces(); | ||
| BOOST_CHECK(!destroyed); | ||
| }, | ||
| [&] { destroyed = true; })); | ||
| TestInterface::Call(); | ||
| BOOST_CHECK(destroyed); | ||
| } | ||
|
|
||
| BOOST_AUTO_TEST_SUITE_END() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.