Closed thehobbit85 closed 6 years ago
I don’t see anywhere where this changes the sighash type. How is using the passed in txid change anything?
You are right, there is no change to the sighash type.
If you follow the commit, you will notice that it should never even try to calculate the txid and the if
statement is there just in case.
The Txids we are getting from electrum are correct, the problem only happened when we recalculated the txid ourselves and then we got a different hash then the one we got from the servers. Thats why passing it along solves it.
When using the function
bc::hash_transaction
, there is a second optional param for the sighash type, and the default isall
, but for segwit tx's it should beanyone_can_pay
.So instead of trying to get the txid using the function, we get it from the txid inside the metadata or from the electrum servers. Only if we never got it, then we will try to calculate it the old way.