-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fix: added error with clear message when signing a tx without outputs #2110
fix: added error with clear message when signing a tx without outputs #2110
Conversation
Perhaps adding a default value of 0 is a better solution. |
Yes that was my first solution, but then I thought, why one would sign a transaction with no outputs? It's probably a mistake, and an error would prevent the user from broadcasting it. |
also, if somebody can give me a hint about the ci test that failed it would be appreciated |
See #2109 |
so? what do you suggest me to do? Also what do you think about the fix? adding a default value is better or the error? |
This is rude. Since you seem to be based in a country where English is not your native language, I take no offence from it. But for future reference, "so?" as a response to anything is pretty rude.
Or just wait until the other PR is merged and then rebase on master. Either one is fine.
Either one is fine. I just wanted to clarify the reasoning behind why you chose one solution over the other. |
I merged #2113 to master. |
07a7262
to
4802803
Compare
so sorry! By no means I wanted to be rude. Thanks for clarifying it. Yes I'm not an English native speaker, will have it in mind from now on. I asked because I didn't want to interfere beyond the purpose of my fix. Thanks! |
There's this line of code
this.outs.map(output => 8 + varSliceSize(output.script)).reduce((a, b) => a + b)
that, when the unsigned transaction has no outputs set,this.outs
is an empty array and the only error it throws says "Reduce of empty array with no initial value", which makes one dig into the bitcoinjs code and understand what it was trying to do. Now the error message helps to understand what is happening.