Repository navigation
test: cut the -j48 --ramdisk functional test run to ~70s without reducing coverage #7988
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
PastaPastaPasta
merged 2 commits into
dashpay:develop
from
PastaPastaPasta:chore/functional-tests-under-80s
Oct 31, 2026
Merged
Changes from all commits
Commits
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
108 changes: 108 additions & 0 deletions
108
test/functional/feature_llmq_is_retroactive_session_timeout.py
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,108 @@ | ||
| #!/usr/bin/env python3 | ||
| # Copyright (c) 2015-2025 The Dash Core developers | ||
| # Distributed under the MIT software license, see the accompanying | ||
| # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
|
||
| ''' | ||
| feature_llmq_is_retroactive_session_timeout.py | ||
|
|
||
| Tests retroactive signing of a partially known TX once the signing session for | ||
| its IS lock timed out, with and without cycling the LLMQs in between. | ||
|
|
||
| We have 5 nodes where node 0 is the control node, nodes 1-4 are masternodes. | ||
| Mempool inconsistencies are simulated via disconnecting/reconnecting node 3 | ||
| and by having a higher relay fee on node 4. | ||
| ''' | ||
|
|
||
| import time | ||
|
|
||
| from test_framework.test_framework import DashTestFramework | ||
| from test_framework.util import set_node_times | ||
|
|
||
|
|
||
| class LLMQ_IS_RetroactiveSigningSessionTimeout(DashTestFramework): | ||
| def add_options(self, parser): | ||
| self.add_wallet_options(parser) | ||
|
|
||
| def set_test_params(self): | ||
| # -whitelist is needed to avoid the trickling logic on node0 | ||
| self.set_dash_test_params(5, 4, [["-whitelist=127.0.0.1"], [], [], [], ["-minrelaytxfee=0.001"]]) | ||
|
|
||
| def assert_no_instantlock(self, txid, node): | ||
| self.log.info(f"Expecting no InstantLock for {txid}") | ||
| assert not node.getrawtransaction(txid, True)["instantlock"] | ||
|
|
||
| def create_fund_sign_tx(self): | ||
| rawtx = self.nodes[0].createrawtransaction([], {self.nodes[0].getnewaddress(): 1}) | ||
| rawtx = self.nodes[0].fundrawtransaction(rawtx)['hex'] | ||
| rawtx = self.nodes[0].signrawtransactionwithwallet(rawtx)['hex'] | ||
| return rawtx | ||
|
|
||
| def run_test(self): | ||
| self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0) | ||
| # Mempool IS signing on | ||
| self.nodes[0].sporkupdate("SPORK_2_INSTANTSEND_ENABLED", 0) | ||
| self.wait_for_sporks_same() | ||
|
|
||
| self.mine_cycle_quorum() | ||
|
|
||
| # Make sure that all nodes are chainlocked at the same height before starting actual tests | ||
| self.wait_for_chainlocked_block_all_nodes(self.nodes[0].getbestblockhash(), timeout=30) | ||
|
|
||
| self.log.info("testing retroactive signing with partially known TX and session timeout") | ||
| self.test_session_timeout(False) | ||
| self.log.info("repeating test, but with cycled LLMQs") | ||
| self.test_session_timeout(True) | ||
|
|
||
| def test_session_timeout(self, do_cycle_llmqs): | ||
| set_node_times(self.nodes, self.mocktime) | ||
| self.isolate_node(3) | ||
| rawtx = self.create_fund_sign_tx() | ||
| txid_all_nodes = self.nodes[0].sendrawtransaction(rawtx) | ||
| txid_all_nodes = self.nodes[3].sendrawtransaction(rawtx) | ||
|
|
||
| rawtx_1 = self.create_fund_sign_tx() | ||
| txid_single_node = self.nodes[3].sendrawtransaction(rawtx_1) | ||
|
|
||
| # Make sure connected nodes received the TX before we continue | ||
| self.bump_mocktime(30) | ||
| self.sync_mempools(self.nodes[:3]) | ||
| # Make sure signing is done on nodes 1 and 2 (it's async) | ||
| time.sleep(5) | ||
| # Make the signing session for the IS lock timeout on nodes 1-3 | ||
| self.bump_mocktime(61) | ||
| time.sleep(2) # make sure Cleanup() is called | ||
| self.reconnect_isolated_node(3, 0) | ||
| # Make sure nodes actually try re-connecting quorum connections | ||
| self.bump_mocktime(30) | ||
| self.wait_for_mnauth(self.nodes[3], 2) | ||
|
|
||
| self.nodes[0].sendrawtransaction(rawtx_1) | ||
| # Make sure connected nodes received the TX | ||
| self.bump_mocktime(30) | ||
| self.sync_mempools(self.nodes[:3]) | ||
| self.bump_mocktime(30) | ||
|
|
||
| # Make sure signing is done on nodes 1 and 2 (it's async) | ||
| time.sleep(5) | ||
|
|
||
| # node 3 fully reconnected but the signing session is already timed out, so no IS lock | ||
| self.assert_no_instantlock(txid_all_nodes, self.nodes[0]) | ||
| self.assert_no_instantlock(txid_single_node, self.nodes[0]) | ||
| if do_cycle_llmqs: | ||
| self.mine_cycle_quorum() | ||
| self.mine_cycle_quorum() | ||
| self.wait_for_chainlocked_block_all_nodes(self.nodes[0].getbestblockhash(), timeout=30) | ||
|
|
||
| time.sleep(5) | ||
| self.assert_no_instantlock(txid_all_nodes, self.nodes[0]) | ||
| self.assert_no_instantlock(txid_single_node, self.nodes[0]) | ||
| # Make node 0 consider the TX as safe | ||
| self.bump_mocktime(10 * 60 + 1) | ||
| block = self.generate(self.nodes[0], 1, sync_fun=self.no_op)[0] | ||
| assert txid_all_nodes in self.nodes[0].getblock(block, 1)['tx'] | ||
| assert txid_single_node in self.nodes[0].getblock(block, 1)['tx'] | ||
| self.wait_for_chainlocked_block_all_nodes(block) | ||
|
|
||
| if __name__ == '__main__': | ||
| LLMQ_IS_RetroactiveSigningSessionTimeout().main() | ||
Oops, something went wrong.
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.