-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor - Transaction Input Types #58
Open
DaMatrix
wants to merge
41
commits into
AIBlockOfficial:develop
Choose a base branch
from
DaMatrix:refactor/tx-in-types
base: develop
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
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 will be useful when I go through and add descriptive errors to everything everywhere
This allows other structs which wrap a fixed-length byte array to simply use it as a field, and not have to deal with any of the details of formatting or JSON hex (de)serialization.
this makes it clear which serialization format is being used where, as we are going to be changing this up soon
This will enable us to keep JSON serialization separate from the binary encoding, and also be much more explicit about the exact binary representation of objects.
# Conflicts: # src/utils/mod.rs
Also implemented PlaceholderIndexed for all crypto structs
… temporary buffer
P2SH doesn't work yet, I don't want it to exist at all for the time being
…or-types # Conflicts: # src/primitives/transaction.rs # src/utils/script_utils.rs # src/utils/transaction_utils.rs
# Conflicts: # src/utils/transaction_utils.rs
…Point instead of a whole TxIn The script part was never used anyway, this just resulted in a bunch of unnecessary temporary TxIns being created without a script.
# Conflicts: # src/primitives/transaction.rs # src/script/interface_ops.rs # src/script/lang.rs # src/utils/script_utils.rs # src/utils/transaction_utils.rs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR depends on #57 (
tx-constructor-types
), #44 (disable-p2sh
), and #49 (addresses
).This replaces
TxIn
with an enum, where each variant contains the necessary information for a transaction input of a specific type. Each variant corresponds exactly to one of the original input script formats. Doing this brings the following advantages:Unfortunately, adding any kind of additional strict input validation when constructing these values is difficult/impossible, as it's impossible to check a single input validity's without knowing the context of the entire enclosing transaction and its input transactions. However, we can at least ensure that the individual fields have legal values thanks to strict typing, and we can ensure that we can't create weird inputs with impossible structures (such as a Coinbase input containing an
OutPoint
).Changelog
TxIn
struct with the new enumtransaction_utils::construct_tx_in_out_signable_hash
to accept anOutPoint
instead of aTxIn
OutPoint
part of theTxIn
, but because it needs to be called before a transaction input is created, there was a ton of code which had to create invalidTxIn
instances with empty scriptsType of Change
Please mark the appropriate option by putting an "x" inside the brackets:
Checklist
Put an "x" in the boxes that apply. If you're unsure about any of these, don't hesitate to ask. We're here to help!
Screenshots (if applicable)
If the changes affect the UI or have visual effects, please provide screenshots or GIFs showcasing the changes.
Additional Context (if applicable)
Add any additional context or information about the changes that may be helpful in understanding the pull request.
Related Issues (if applicable)
If this pull request is related to any existing issues, please list them here.
Requested Reviewers
Mention any specific individuals or teams you would like to request a review from.