fanquake
744157ef1a
Merge bitcoin/bitcoin#28602 : descriptors: Disallow hybrid and uncompressed keys when inferring
...
74c77825e5 test: Unit test for inferring scripts with hybrid and uncompressed keys (Andrew Chow)
f895f97014 test: Scripts with hybrid pubkeys are migrated to watchonly (Andrew Chow)
37b9b73477 descriptors: Move InferScript's pubkey validity checks to InferPubkey (Andrew Chow)
b7485f11ab descriptors: Check result of InferPubkey (Andrew Chow)
Pull request description:
`InferDescriptor` was not always checking that the pubkey it was placing into the descriptor was an allowed pubkey. For example, given a P2WPKH script that uses an uncompressed pubkey, it would produce a `wpkh()` with the uncompressed key. Additionally, the hybrid key check was only being done for `pk()` scripts, where it should've been done for all scripts.
This PR moves the key checking into `InferPubkey`. If the key is not valid for the context, then `nullptr` is returned and the inferring will fall through to the defaults of either `raw()` or `addr()`.
This also resolves an issue with migrating legacy wallets that contain hybrid pubkeys as such watchonly scripts will become `raw()` or `addr()` and go to the watchonly wallet. Note that a legacy wallet cannot sign for hybrid pubkeys. A test has been added for the migration case.
Also added unit tests for `InferDescriptor` itself as the edge cases with that function are not covered by the descriptor roundtrip test.
ACKs for top commit:
furszy:
ACK 74c77825
Sjors:
utACK 74c77825e5
Tree-SHA512: ed5f63e42a2e46120245a6b0288b90d2a6912860814c6c08fe393332add1cb364dc5eca72f16980352143570aef0c07bf1a91acd294099463bd028b6ce2fe40c
2023-10-11 12:50:43 +02:00
..
2023-10-04 16:04:07 +01:00
2023-08-14 17:39:49 -04:00
2023-08-08 17:50:41 +02:00
2023-09-08 11:16:06 +02:00
2022-08-13 13:55:38 +01:00
2023-09-20 21:11:55 +01:00
2023-09-30 06:38:47 -04:00
2023-06-15 10:27:56 -06:00
2023-09-30 06:38:47 -04:00
2023-05-20 12:08:13 +02:00
2023-10-09 14:54:08 +01:00
2022-09-29 16:43:30 +01:00
2023-01-31 18:48:50 +01:00
2022-10-23 15:03:04 +01:00
2023-10-06 19:43:32 +02:00
2023-10-05 19:08:19 -04:00
2023-09-19 16:38:08 +02:00
2023-10-09 14:12:00 +01:00
2023-10-06 19:43:32 +02:00
2023-10-09 14:07:37 -04:00
2023-09-04 12:51:20 -04:00
2023-09-27 15:05:15 -04:00
2023-10-09 14:07:37 -04:00
2023-07-27 14:24:52 +02:00
2023-10-03 09:57:46 -04:00
2023-10-05 15:47:44 +02:00
2023-09-30 06:38:47 -04:00
2023-06-29 11:59:31 +01:00
2023-10-10 11:02:10 +01:00
2023-09-15 14:27:20 +01:00
2023-09-05 10:13:25 +02:00
2023-09-12 12:14:31 -04:00
2023-09-12 12:14:31 -04:00
2023-10-02 15:34:28 +02:00
2023-10-02 15:34:28 +02:00
2023-10-02 15:34:28 +02:00
2022-12-24 23:49:50 +00:00
2023-02-01 11:33:35 +01:00
2023-05-04 20:57:51 +01:00
2023-05-20 12:08:13 +02:00
2023-03-23 12:55:18 +01:00
2022-12-24 23:49:50 +00:00
2022-12-24 23:49:50 +00:00
2022-12-24 23:49:50 +00:00
2023-09-10 16:11:52 -04:00
2023-09-10 16:11:52 -04:00
2023-09-12 22:51:42 +02:00
2023-05-20 12:08:13 +02:00
2023-07-25 17:40:07 +02:00
2023-09-12 22:51:42 +02:00
2023-05-20 12:08:13 +02:00
2023-06-16 10:38:19 +01:00
2023-08-05 10:42:56 +02:00
2023-02-15 14:42:28 -08:00
2023-09-19 14:19:57 +00:00
2023-08-17 18:28:15 +02:00
2022-12-24 23:49:50 +00:00
2023-10-06 19:43:32 +02:00
2023-05-25 19:24:05 +02:00
2023-05-25 19:24:05 +02:00
2023-05-10 10:39:58 +02:00
2023-05-10 10:39:58 +02:00
2023-04-20 06:08:22 -07:00
2023-06-16 10:38:19 +01:00
2022-12-24 23:49:50 +00:00
2022-12-24 23:49:50 +00:00
2023-10-09 14:52:00 -04:00
2023-10-09 14:52:00 -04:00
2023-08-14 17:38:27 -04:00
2023-07-25 17:40:07 +02:00
2023-07-25 17:40:07 +02:00
2023-08-14 17:39:49 -04:00
2023-01-31 11:50:10 +00:00
2023-09-12 12:07:39 +02:00
2023-09-12 12:07:39 +02:00
2023-03-15 16:42:42 +01:00
2023-03-15 16:42:42 +01:00
2022-12-24 23:49:50 +00:00
2022-12-24 23:49:50 +00:00
2023-04-19 10:48:30 +02:00
2023-05-09 18:48:52 +02:00
2023-05-20 12:08:13 +02:00
2023-03-23 12:52:00 +01:00
2023-04-03 14:41:22 +01:00
2022-12-24 23:49:50 +00:00
2023-09-19 16:38:08 +02:00
2023-10-05 11:36:03 +01:00
2022-12-12 21:06:04 +00:00
2023-05-09 18:47:14 +02:00
2023-10-03 13:35:46 +01:00
2022-12-24 23:49:50 +00:00
2023-08-24 14:39:58 +02:00
2023-08-24 14:39:58 +02:00
2023-10-09 14:52:00 -04:00
2023-07-10 10:47:17 -03:00
2023-09-19 16:48:43 +00:00
2023-08-14 17:38:27 -04:00
2023-09-27 15:05:26 -04:00
2023-09-27 15:05:26 -04:00
2023-08-29 16:41:22 +01:00
2023-08-29 16:41:22 +01:00
2023-09-23 18:42:36 +01:00
2023-09-13 11:37:13 +01:00
2022-04-26 16:25:38 -04:00
2022-06-23 15:33:01 +02:00
2022-07-21 10:42:09 +01:00
2023-09-01 07:39:00 +01:00
2023-02-03 22:33:14 +01:00
2022-09-13 17:15:17 +01:00
2022-11-17 14:52:45 +00:00
2023-07-19 10:26:11 +01:00
2023-09-27 16:27:05 -04:00
2023-06-16 10:38:19 +01:00
2023-01-28 15:24:13 +00:00
2023-09-13 11:37:45 +01:00
2023-05-30 11:39:59 -04:00
2022-12-24 23:49:50 +00:00
2023-10-06 19:43:32 +02:00
2023-10-03 11:23:24 +01:00
2022-12-24 23:49:50 +00:00
2023-10-04 11:04:43 -04:00
2023-10-04 11:04:43 -04:00
2023-07-19 12:43:05 -06:00
2023-09-21 11:26:16 -04:00
2023-08-24 14:40:03 +02:00
2023-05-26 13:41:07 -03:00
2023-08-25 17:09:32 +02:00
2022-04-20 14:35:53 +01:00
2023-09-19 14:19:57 +00:00
2022-12-24 23:49:50 +00:00
2023-08-14 17:38:27 -04:00
2023-08-14 17:38:27 -04:00
2022-12-24 23:49:50 +00:00
2022-12-24 23:49:50 +00:00
2023-03-26 15:49:52 +02:00
2023-10-02 18:09:53 -04:00
2023-10-02 18:09:53 -04:00
2023-10-08 02:43:24 +02:00
2023-09-19 14:19:57 +00:00
2023-10-08 02:43:19 +02:00
2023-10-08 02:43:19 +02:00
2023-09-12 22:51:48 +02:00
2023-08-17 15:26:34 -04:00
2023-09-12 22:51:48 +02:00
2023-06-12 10:24:14 -03:00
2022-03-10 12:01:53 +01:00
2023-01-12 13:42:44 +00:00
2023-06-16 10:38:19 +01:00
2022-12-24 23:49:50 +00:00
2023-10-08 02:43:17 +02:00
2023-06-28 09:52:33 +02:00
2023-06-28 09:52:33 +02:00
2023-09-19 14:19:57 +00:00
2023-07-24 15:32:35 +02:00
2023-07-19 18:12:42 +02:00
2023-10-02 12:33:54 +02:00
2023-10-02 18:11:11 -04:00
2023-04-19 10:48:30 +02:00
2022-12-24 23:49:50 +00:00
2023-01-31 11:50:10 +00:00
2023-08-17 23:58:47 -05:00
2023-08-17 23:58:47 -05:00
2023-09-05 11:37:35 +01:00
2023-08-01 15:27:33 +02:00
2023-09-20 10:34:09 -04:00
2023-09-23 18:42:36 +01:00
2023-08-29 16:41:22 +01:00
2023-06-20 10:23:08 +02:00
2023-07-17 13:27:46 +02:00
2022-12-10 14:34:44 -06:00
2023-06-28 15:12:12 -04:00
2023-10-06 19:43:32 +02:00
2023-10-06 18:12:31 +02:00
2023-09-30 06:38:47 -04:00
2023-09-30 06:38:47 -04:00
2023-09-05 10:13:25 +02:00
2023-01-03 19:31:29 -06:00
2022-12-24 23:49:50 +00:00
2022-12-24 23:49:50 +00:00
2023-05-20 12:08:13 +02:00