-
Notifications
You must be signed in to change notification settings - Fork 2k
Refactor BlockTools
#19492
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
arvidn
wants to merge
9
commits into
main
Choose a base branch
from
refactor
base: main
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
Refactor BlockTools
#19492
Conversation
This file contains 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 pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
…rom transaction_data
… mutate state as if spends will make it in until once it's confirmed
almogdepaz
reviewed
Apr 11, 2025
almogdepaz
approved these changes
Apr 14, 2025
AmineKhaldi
approved these changes
Apr 14, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Changed
Required label for PR that categorizes merge commit message as "Changed" for changelog
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.
Purpose:
Simplify
BlockTools
to make it easier and more robust to additions and changes.This PR is best reviewed one commit at a time.
One realization (that's mentioned in a new comment in this PR) is that we don't know whether a block will end up a transaction block or not up-front. We always prepare the transactions and pass into
get_full_block_and_block_record()
, only afterwards do we know whether the transactions were included or not.The
include_transactions
feature (which includes some number of transactions in each TX block) maintains a list ofavailable_coins
that it spends some of, and add the coins created by those spends. These spends used to rely on another featuretransaction_data
(which can also be passed in by the caller), in order to "wait" until we get a transaction block to make the next set of transactions.This patch removes this coupling and instead explicitly updates
available_coins
every time we get a transaction block. This makes the transactions not be created identically to the current chains and causes validation failures. That's why this needs an updatedtest-cache
version of the blockchains. (available here)Current Behavior:
get_consecutive_blocks()
.include_transactions
feature generate dummy transactions by settingtransaction_data
transaction_data_included
is set to true whentransaction_data
is included into a block that turned out to be a transaction block. We then settransaction_data
toNone
to not include it again.start_height
parameter was unusedavailable_coins
and we remove the coins immediately when we create the bundle. This means we must keep the bundle around until the generated blocks turns out to be a transaction block (hence the dependency ontransaction_data
.New Behavior:
setup_new_gen()
)transaction_data
feature is now independent frominclude_transactions
feature.transaction_data_included
was removed.transaction_data
is set toNone
directlystart_height
parameter was removedavailable_coins
and we remove coins we spent if the block turned into a transaction blockTesting Notes: