Closed jrwbabylonlab closed 2 months ago
newData
should be { sighashType: 0 }
If this is a miscommunication of the problem, then it might be easier if you can write a small example showing the issue with actual code.
Hi @junderw thanks for getting back to me on this. Please check the example here: https://github.com/jrwbabylonlab/bitcoinjs-example
Let me know if further clarification is needed
hi @junderw or @jasonandjay could you please double check the example scripts i provided above when u have time? Not sure how to re-open this issue as there is no such option.
I'm still not sure what the issue is, but it seems like in your OP you found the issue.
Please create a PR on the bip174 repository and get it to pass all the tests. Also add a test if you can that will fail with the current code but is fixed with your new code.
I'll look it over and merge it if the tests pass and the change is small.
Some what related to issue https://github.com/bitcoinjs/bitcoinjs-lib/issues/2046 but not entirely.
The bug we are facing is that we can not set the
sighashType: bitcoin.Transaction.SIGHASH_DEFAULT
whentapLeafScript
is not present. It will throw the error ofCannot add duplicate data to input
Digger further, the error seems to come from https://github.com/bitcoinjs/bip174/blob/master/src/lib/converter/input/sighashType.js#L29-L31
In our case, the currentData is
whereas the newData is 0
Due to !!0 is false in js, this canAdd method is false as well. hence throw at the bitcoinjs method of