ElementsProject / ElementsProject/elements

`signrawtransactionwithwallet` produces invalid Schnorr signatures

Open
#1,238 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.2k
Forks
416
Avg merge
1d 23h
Merged PRs (30d)
15

Description

If you try modifying the `wallet_taproot.py` functional test like so:

```
diff --git a/test/functional/wallet_taproot.py b/test/functional/wallet_taproot.py
index 123a6a40893..f37fc906549 100755
--- a/test/functional/wallet_taproot.py
+++ b/test/functional/wallet_taproot.py
@@ -275,6 +275,12 @@ class WalletTaprootTest(BitcoinTestFramework):
self.nodes[0].generatetoaddress(1, self.boring.getnewaddress())
test_balance = int(self.rpc_online.getbalance()['bitcoin'] * 100000000)
ret_amnt = random.randrange(100000, test_balance)
+ # Start...
+ rawret = self.rpc_online.createrawtransaction([], [{self.boring.getnewaddress(): Decimal(ret_amnt) / 100000000}])
+ rawret = self.rpc_online.fundrawtransaction(rawret, {"changePosition":1, "subtractFeeFromOutputs":[0]})
+ rawret = self.rpc_online.signrawtransactionwithwallet(rawret['hex'])
+ self.rpc_online.sendrawtransaction(rawret['hex'])
+ # ...end
res = self.rpc_online.sendtoaddress(address=self.boring.getnewaddress(), amount=Decimal(ret_amnt) / 100000000, subtractfeefromamount=True)
self.nodes[0].generatetoaddress(1, self.boring.getnewaddress())
assert(self.rpc_online.gettransaction(res)["confirmations"] > 0)
```

You will get a failure of the form
```
test_framework.authproxy.JSONRPCException: non-mandatory-script-verify-flag (Invalid Schnorr signature) (-26)
```
on the `sendrawtransaction` line. You can verify by printing intermediate values that the output of `signrawtransactionwithwallet` shows `complete: true` and that the transaction indeed has something Schnorr-signature-shaped in its witness.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.