forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 0
Merge bitcoin/bitcoin#27191: blockstorage: Adjust fastprune limit if block exceeds blockfile size #1138
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
Open
DashCoreAutoGuix
wants to merge
6
commits into
backport-0.25-batch-415
Choose a base branch
from
backport-0.25-batch-415-pr-27191
base: backport-0.25-batch-415
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Merge bitcoin/bitcoin#27191: blockstorage: Adjust fastprune limit if block exceeds blockfile size #1138
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ba1918b
Merge bitcoin/bitcoin#27191: blockstorage: Adjust fastprune limit if …
fanquake f0b677c
dash: adapt feature_fastprune test for non-segwit
claude 3b3081b
validation: fix feature_fastprune test - generate UTXOs for MiniWallet
dfbbfef
validation: fix feature_fastprune test - properly create CbTx for Dash
claude dc69d72
validation: simplify feature_fastprune test - use OP_RETURN instead o…
claude 20f982e
validation: fix feature_fastprune test - fund MiniWallet with UTXO
claude 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| #!/usr/bin/env python3 | ||
| # Copyright (c) 2023 The Bitcoin Core developers | ||
| # Distributed under the MIT software license, see the accompanying | ||
| # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
| """Test fastprune mode.""" | ||
| from test_framework.test_framework import BitcoinTestFramework | ||
| from test_framework.util import ( | ||
| assert_equal | ||
| ) | ||
| from test_framework.blocktools import ( | ||
| create_block, | ||
| create_coinbase, | ||
| ) | ||
| from test_framework.messages import CTxOut, tx_from_hex | ||
| from test_framework.script import CScript, OP_RETURN | ||
| from test_framework.wallet import MiniWallet | ||
|
|
||
|
|
||
| class FeatureFastpruneTest(BitcoinTestFramework): | ||
| def set_test_params(self): | ||
| self.num_nodes = 1 | ||
| self.extra_args = [["-fastprune"]] | ||
|
|
||
| def run_test(self): | ||
| self.log.info("ensure that large blocks don't crash or freeze in -fastprune") | ||
| wallet = MiniWallet(self.nodes[0]) | ||
|
|
||
| # Create a single transaction with large OP_RETURN to make block >64kb | ||
| # We need to create a transaction that's large enough to exceed the fastprune limit | ||
| tx = wallet.create_self_transfer()['tx'] | ||
| # Add a large OP_RETURN output (65kb of data to exceed 64kb fastprune limit) | ||
| large_data = b'\x00' * 65536 | ||
| tx.vout.append(CTxOut(0, CScript([OP_RETURN, large_data]))) | ||
| tx.rehash() | ||
|
|
||
| tip = int(self.nodes[0].getbestblockhash(), 16) | ||
| time = self.nodes[0].getblock(self.nodes[0].getbestblockhash())['time'] + 1 | ||
| height = self.nodes[0].getblockcount() + 1 | ||
|
|
||
| # Create proper CbTx for Dash (DIP4/v20 activated) | ||
| cbb = create_coinbase(height, dip4_activated=True, v20_activated=True) | ||
| gbt = self.nodes[0].getblocktemplate() | ||
| cbb.vExtraPayload = bytes.fromhex(gbt["coinbase_payload"]) | ||
| cbb.rehash() | ||
|
|
||
| block = create_block(hashprev=tip, ntime=time, txlist=[tx], coinbase=cbb, version=4) | ||
|
|
||
| # Add quorum commitments from block template | ||
| for tx_obj in gbt["transactions"]: | ||
| tx = tx_from_hex(tx_obj["data"]) | ||
| if tx.nType == 6: # TRANSACTION_QUORUM_COMMITMENT | ||
| block.vtx.append(tx) | ||
|
|
||
| block.hashMerkleRoot = block.calc_merkle_root() | ||
| block.solve() | ||
| result = self.nodes[0].submitblock(block.serialize().hex()) | ||
| # submitblock returns None on success, error string on failure | ||
| if result is not None: | ||
| raise AssertionError(f"submitblock failed: {result}") | ||
| assert_equal(int(self.nodes[0].getbestblockhash(), 16), block.sha256) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| FeatureFastpruneTest().main() | ||
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
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.