-
Notifications
You must be signed in to change notification settings - Fork 32
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: get input data based on address type #74
Conversation
const addressType = multisigAddressType(input.multisig); | ||
|
||
// The PSBT class in bitcoinjs-lib won't accept both nonWitnessUxo and witnessUtxo | ||
// but ledger v2 needs nonWitnessUtxo data in the PSBT for any transactions that aren't | ||
// native segwit. So we need to pick which one to give based on the address type | ||
// https://github.com/bitcoinjs/bitcoinjs-lib/issues/1595 | ||
const utxoToVerify = | ||
addressType === P2WSH ? { witnessUtxo } : { nonWitnessUtxo }; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is basically the only relevant change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we talked about this out-of-band, but there are still some signature test failures on this which is to be expected since the psbt contents are changing.
I went to go see about the sigs myself, but I'm still getting invalid data error |
@Shadouts thats weird… |
So, the correct behavior for this is that if it's |
Not required anymore for now. Closing. |
Some eslint fixes got caught in this but basically the input data for adding to a psbt needs to be a bit smarter about how it gets the input data for ledger v2 which is pickier about when it requires nonWitnessUtxo vs witnessUtxo data. (See here from the bip174 docs).
Unfortunately while this creates a valid PSBT that ledger will sign, the signatures created after getting converted to psbtv2 and getting passed to the ledger are still wrong so there's still some tweaking left to do.
Can test with: unchained-capital/caravan#294