|
205 | 205 | class WalletMiniscriptTest(BitcoinTestFramework):
|
206 | 206 | def add_options(self, parser):
|
207 | 207 | self.add_wallet_options(parser, legacy=False)
|
| 208 | + self.rpc_timeout = 480 |
208 | 209 |
|
209 | 210 | def set_test_params(self):
|
210 | 211 | self.num_nodes = 1
|
@@ -373,6 +374,31 @@ def run_test(self):
|
373 | 374 | desc.get("sha256_preimages"),
|
374 | 375 | )
|
375 | 376 |
|
| 377 | + # Test we can sign for a max-size TapMiniscript. Recompute the maximum accepted size |
| 378 | + # for a TapMiniscript (see cpp file for details). Then pad a simple pubkey check up |
| 379 | + # to the maximum size. Make sure we can import and spend this script. |
| 380 | + leeway_weight = (4 + 4 + 1 + 36 + 4 + 1 + 1 + 8 + 1 + 1 + 33) * 4 + 2 |
| 381 | + max_tapmini_size = 400_000 - 3 - (1 + 65) * 1_000 - 3 - (33 + 32 * 128) - leeway_weight - 5 |
| 382 | + padding = max_tapmini_size - 33 - 1 |
| 383 | + ms = f"pk({TPRVS[0]}/*)" |
| 384 | + ms = "n" * padding + ":" + ms |
| 385 | + desc = f"tr({PUBKEYS[0]},{ms})" |
| 386 | + self.signing_test(desc, None, None, 1, 3, None) |
| 387 | + # This was really the maximum size, one more byte and we can't import it. |
| 388 | + ms = "n" + ms |
| 389 | + desc = f"tr({PUBKEYS[0]},{ms})" |
| 390 | + res = self.ms_wo_wallet.importdescriptors( |
| 391 | + [ |
| 392 | + { |
| 393 | + "desc": descsum_create(desc), |
| 394 | + "active": False, |
| 395 | + "timestamp": "now", |
| 396 | + } |
| 397 | + ] |
| 398 | + )[0] |
| 399 | + assert not res["success"] |
| 400 | + assert "is not a valid descriptor function" in res["error"]["message"] |
| 401 | + |
376 | 402 |
|
377 | 403 | if __name__ == "__main__":
|
378 | 404 | WalletMiniscriptTest().main()
|
0 commit comments