-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Problem about making modular transaction with psbt #2004
Comments
Look at the sighashes you're signing (you can insert print statements to see why they differ before the sig msg is hashed). If they're different, then that's why you get an invalid final signature. Also look at the ordering of the keys in the script as well: tapscript doesn't have a normal multi-sig op code, so you either need to use checksigadd or a normal checksig. |
Printed sighashes, they differ. But they generated from different UnsignedTx and OutFetcher, they should be same? sighashes1:
sighashes2:
For result, there're 2 input(first from psbt2, second from psbt1) and 2 output(first from psbt2, second from psbt1). Alice wants to sell something and receive bitcoin(psbt1, use Single|AnyOneCanPay). Then Bob pays(psbt2, Default) and gets change. Perhaps this's not multi-sig? I don't know what to call it. |
All codes:
|
Can you print the two extracted raw transactions please? Did you try if things work if you use |
Only extracted second psbt: Got same error by using If i finalize and extract first psbt(use |
Ah, I see what you're attempting to do now. And looking at the TX you sent, it is missing the sighash flag at the end of the signature. So that gets lost somewhere when splicing together the two transactions. |
I tried to add sighash flag,but not working:
I changed value of output and tried to add sighash flag, here is new extracted tx: Looks that also there isn't a sighash flag at end of signature. |
Try adding it to the witness manually. I think this might be a bug in the PSBT library that the sighash is ignored when finalizing. EDIT: This here should take into account the sighash flag: btcd/btcutil/psbt/finalizer.go Line 522 in 2dbc98b
|
It worked, thank you very much! |
I want to create 2 of 2 multisig tx with psbt. But got error:
non-mandatory-script-verify-flag (Invalid Schnorr signature)
Here are steps, psbt1 and psbt2 are different instances:
txscript.TaprootWitnessSignature
withtxscript.SigHashSingle|txscript.SigHashAnyOneCanPay
and use private_key1updater.Upsbt.Inputs[0].TaprootKeySpendSig = witness from 2
UnsignedTx
txscript.TaprootWitnessSignature
withtxscript.SigHashDefault
and use another private_keyupdater.Upsbt.Inputs[0].TaprootKeySpendSig = witness from 6
Then got error.
Here is codes of 5:
The text was updated successfully, but these errors were encountered: