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

Psbt addOutput mutates the target #1805

Closed
landabaso opened this issue May 30, 2022 · 0 comments
Closed

Psbt addOutput mutates the target #1805

landabaso opened this issue May 30, 2022 · 0 comments

Comments

@landabaso
Copy link

It's really a minor thing.

addOutput adds the script property to the target (mutating it) here:

outputData = Object.assign(outputData, { script });

As I said it's just a minor thing that I noticed because my tests were failing since I was comparing target objects to final tx retrieved from regtest chain and was not expecting this object to had been changed.

Could be easily solved with something like this:

outputData = {...outputData, script}; 

As a workaround I'm cloning the input parameter so it's not a big deal but might be nice to correct it in future releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants