Closed paulo-bc closed 1 month ago
Hi @paulo-bc, thank you for opening the issue. Could you please advise do you tweak the p2tr_pk_str
private key? In WalletCore, we take original ECDSA/Schnorr private keys, and tweak them ourselves.
Hi @satoshiotomakan, I have not tweaked the p2tr_pk_str
private key, it is the standard one for the m/86'/1'/0'/0/0
derivation.
Do you mean I have to tweak it myself and then use the result in BitcoinV2SigningInput.with
, or that BitcoinV2SigningInput.with
will already tweak it?
Edit: Seems like it is the latter, as this seems to do the tweaking. Right?
Edit 2: I have updated the original post with another test case that successfully signs a tx with a single P2TR Input/Output.
Hi @paulo-bc, thank you for giving the context. No, the private key has to be not tweaked, so your code looks good. I'll try to reproduce the same problem today and will be right back
Hi @paulo-bc, I fixed the issue at the PR https://github.com/trustwallet/wallet-core/pull/3979
Describe the bug
Building a transaction with two inputs (one P2TR utxo and one P2WPKH utxo), transaction successfully builds but error
non-mandatory-script-verify-flag (Invalid Schnorr signature)
happens when trying to broadcast.To Reproduce Using 4.1.0 release,
test_sign_with_p2tr_and_p2wpkh
test passes, but the built transaction fails to broadcast. To prove that signing a tx with a single P2TR input works as expected, we wrotetest_sign_with_p2tr_only
. That test passes, and the resulting transaction was broadcasted successfully.Expected behavior Transaction is broadcasted successfully.
Additional context This unit test runs on TestNet3, but the same issue happens on mainnet. Broadcaster:
https://mempool.space/testnet/tx/push
Note that if two P2TR inputs are used, transaction can be broadcasted successfully.