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

Enforce OP_RETURN standardness #1726

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rustaceanrob
Copy link
Contributor

Closes #1718

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

@ValuedMammal
Copy link
Contributor

Should we use a default max size of 83 as shown here?

https://github.com/bitcoin/bitcoin/blob/110183746150428e6385880c79f8c5733b1361ba/src/policy/policy.h#L68-L72

@notmandatory notmandatory added audit Suggested as result of external code audit module-wallet labels Nov 18, 2024
@notmandatory notmandatory added this to the 1.0.0-beta milestone Nov 18, 2024
@notmandatory notmandatory added the api A breaking API change label Nov 19, 2024
Copy link
Contributor

@oleonardolima oleonardolima left a comment

Choose a reason for hiding this comment

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

utACK f7d6dcf

@notmandatory notmandatory removed this from the 1.0.0-beta milestone Nov 20, 2024
@@ -104,6 +104,10 @@ pub enum CreateTxError {
MissingNonWitnessUtxo(OutPoint),
/// Miniscript PSBT error
MiniscriptPsbt(MiniscriptPsbtError),
/// Multiple recipients are OP_RETURN outputs
MultipleOpReturn,
Copy link
Member

Choose a reason for hiding this comment

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

Why are we disallowing multiple OP_RETURN outputs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the same reason as the byte limitation, it would be non-standard

Copy link
Member

Choose a reason for hiding this comment

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

Although OP_RETURN outputs larger than 83 are non-standard, they are still considered to be valid transactions. I think we should still allow building non-standard txs in build_tx.

I think the better approach would be to have TxBuilder::add_data return an error. This provides instant-feedback for the caller and we can document the restriction on the method.

@rustaceanrob
Copy link
Contributor Author

I think this is best put off for 2.0.0. The functionality to build OP_RETURN transactions is present and this is really a matter of standardness, which is up for debate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api A breaking API change audit Suggested as result of external code audit module-wallet
Projects
Status: Needs Review
Development

Successfully merging this pull request may close these issues.

Enforce standardness rules for TxBuilder::add_data
5 participants