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

Error: No, this would invalidate signatures #503

Closed
adityapatadia opened this issue Nov 22, 2015 · 9 comments
Closed

Error: No, this would invalidate signatures #503

adityapatadia opened this issue Nov 22, 2015 · 9 comments

Comments

@adityapatadia
Copy link

I am getting following error

Error: No, this would invalidate signatures
at TransactionBuilder.addOutput (node_modules/bitcoinjs-lib/src/transaction_builder.js:236:21)

Can't trace its root. Can someone help me here?

@fanatid
Copy link
Member

fanatid commented Nov 23, 2015

Are you trying add output to signed tx (fully or partially)?

@adityapatadia
Copy link
Author

I dont think so. I add only before sign. Is it possible that this will happen before sign?

Moreover, I will properly debug my code today and let you know.

On 23-Nov-2015, at 11:12 AM, Kirill Fomichev [email protected] wrote:

Are you trying add output to signed tx (fully or partially)?


Reply to this email directly or view it on GitHub #503 (comment).

@dcousens
Copy link
Contributor

@adityapatadia this only occurs when a signature already exists, and the SIGHASH type is incompatible.
In most cases, SIGHASH_ALL is used (the default), and once that is applied, the inputs/outputs of the transactions cannot change without invalidating signatures. Hence the error.

@fanatid
Copy link
Member

fanatid commented Nov 23, 2015

@dcousens BTW, why condition is

return (input.hashType & 0x1f) === Transaction.SIGHASH_SINGLE

As I understand should be:

return (input.hashType & 0x1f) === Transaction.SIGHASH_SINGLE ||
       (input.hashType & 0x1f) === Transaction.SIGHASH_NONE

@dcousens
Copy link
Contributor

Indeed.

@dcousens
Copy link
Contributor

@fanatid could you make a new issue?
Late here, but, I'll fix it tomorrow. Test case appreciated if you have one 👍.

@dcousens
Copy link
Contributor

Resolved in #504

@adityapatadia
Copy link
Author

Thanks for the fast fix but I also confirm that it happened for me because of my code. tx object was not properly initialised which caused this error (I did not write 'var' in front of tx object while defining it which made it global object and hence problems).

@dcousens
Copy link
Contributor

No worries @adityapatadia, thanks for reporting the issue any way 👍

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

No branches or pull requests

3 participants