Commit b553acb
committed
re-export WPubkeyHash and PubkeyHash rather than defining our own
We already re-export and use rust-bitcoin's PublicKey type. The two hashes of
keys that are used in Script are identical in Bitcoin and Elements, and have
convenience methods that come with the bitcoin PublicKey type.
To use these convenience methods, drop the PubkeyHash and WPubkeyHash types
and just re-export the rust-bitcoin ones.
We keep the scripthash types separate because Elements Script is meaningfully
different from Bitcoin Script.
**Importantly**, because upstream our WPubkeyHash returns an error if you
try to give it an uncompressed public key, we panic in this case. The 'correct'
way to handle this would be to have distinct compressed/uncompressed public
key types, but those are not yet available from rust-bitcoin. Our current
behavior is to compute a "wpkh" output which is unspendable, which seems
like a very serious loss-of-funds problem, so we panic instead.1 parent 5c22659 commit b553acb
2 files changed
Lines changed: 10 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | 239 | | |
244 | 240 | | |
245 | | - | |
| 241 | + | |
246 | 242 | | |
247 | 243 | | |
248 | 244 | | |
| |||
264 | 260 | | |
265 | 261 | | |
266 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | 272 | | |
277 | 273 | | |
278 | 274 | | |
279 | 275 | | |
280 | | - | |
| 276 | + | |
281 | 277 | | |
282 | 278 | | |
283 | 279 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
55 | | - | |
56 | | - | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
60 | | - | |
61 | 60 | | |
62 | 61 | | |
63 | 62 | | |
| |||
0 commit comments