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

Should contract output never be merged? #440

Open
nemo83 opened this issue Sep 14, 2024 · 1 comment
Open

Should contract output never be merged? #440

nemo83 opened this issue Sep 14, 2024 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@nemo83
Copy link
Contributor

nemo83 commented Sep 14, 2024

More a question than a bug.

I just tried to send to the same script address 10 utxo in one tx. Outputs have been merged by default. Which I didn't think/expect.

Should output sent to script never be merged?

Some options,

  • leave it as is (but dev will learn the hard way!)
  • never merge pay to contract address, and user has no control
  • pay to contract accepts a flag allowMerge (set to false by default)
  • update merge outputs method from being true/false, to accept an enum: mergeOutput(NO|PAYMENT_ADDRESS_ONLY|ALL)
@satran004
Copy link
Member

satran004 commented Sep 14, 2024

@nemo83 Yes, currently the only way to achieve that is through QuickTxBuilder's mergeOutput(false).

In the case of mergeOutput = true, which is the default behavior, if there are multiple script outputs with the same script address, the values will be merged into one output, and only the first datum will be used.

But you are right. I think we should not allow output merging for scripts, as in this case, the user's intention is to create multiple outputs, possibly with different datums.

One way to achieve this would be to prevent merging if the output contains any datum or script reference.

So, only outputs with values will be allowed to merge. Alternatively, we can also detect if it's a script address.

Let's tag this as an enhancement.

@satran004 satran004 added the enhancement New feature or request label Sep 14, 2024
@satran004 satran004 modified the milestones: 0.6.0-beta2, 0.6.1 Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants