Skip to content
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

Allow single account command in transaction inputs #1330

Merged
merged 6 commits into from
Nov 2, 2023

Conversation

azarovh
Copy link
Member

@azarovh azarovh commented Nov 2, 2023

  • Main motivation for this PR is to allow only one authorizable account command per tx inputs. To easily control that I isolated all commands into a separate type so that they can be easily checked for uniqueness.
  • Also this PR allows empty outputs in transaction that has input commands because some commands do not produce output (lock supply, freeze, change authority) thus it won't require user to use fake outputs

@azarovh azarovh force-pushed the feat/tx_input_account_op_arm branch 2 times, most recently from ae85c10 to 3a72063 Compare November 2, 2023 12:37
@azarovh azarovh force-pushed the feat/tx_input_account_op_arm branch from 3a72063 to fdcafe2 Compare November 2, 2023 13:39
@azarovh azarovh force-pushed the feat/tx_input_account_op_arm branch from fdcafe2 to 51c7182 Compare November 2, 2023 13:45
@azarovh azarovh changed the title Separate account authorizable commands into separate struct Allow single authorizable command in transaction inputs Nov 2, 2023
@azarovh azarovh changed the title Allow single authorizable command in transaction inputs Allow single account command in transaction inputs Nov 2, 2023
@azarovh azarovh marked this pull request as ready for review November 2, 2023 13:52
@azarovh azarovh requested a review from OBorce November 2, 2023 13:54
@azarovh azarovh added the chainstate Chainstate-related issues label Nov 2, 2023
Comment on lines +162 to +169
let account_commands_count = tx
.inputs()
.iter()
.filter(|input| match input {
TxInput::Utxo(_) | TxInput::Account(..) => false,
TxInput::AccountCommand(..) => true,
})
.count();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth it... geez it was a nightmare of complexity.

@TheQuantumPhysicist TheQuantumPhysicist merged commit e91bc99 into master Nov 2, 2023
@TheQuantumPhysicist TheQuantumPhysicist deleted the feat/tx_input_account_op_arm branch November 2, 2023 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chainstate Chainstate-related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants