Commit 45a6938
committed
export pset::error::PsetHash
This type appears in the public API as part of the pset::Error type.
However, the type itself is not exported, preventing users from naming
or directly constructing it. This prevents construction of a single
variant of pset::Error, and in particular prevents us from semver-tricking
the Error type.
It is bad practice to export the pset::Error type without also exporting
its constituent types (except as an intentional form of sealing, which
this is not). That is enough reason to accept this PR. But to give a more
elaborate reason:
1. I would like to semver-trick 0.25.3 by re-exporting all the types from
0.26.0 except the ones that changed (`PartiallySignedTransaction`,
`TxOut`, `pset::raw::ProprietaryKey`, and types that expose these in
their public APIs: `Transaction`, `Block` and the sighash cache).
2. I need to re-export the `encode::Error` type, which fortunately did not
change since 0.25.x, so that I can re-use the Encodable/Decodable logic
for all the types that I'm re-exporting. (I can either re-export those
traits directly, along with the error type, or implement a new one with
impls that pass through to the 0.26.x one ... or retain a *ton* of
explicit unreviewable code which probably won't even compile without
changes to handle some types becoming foreign).
3. However, `encode::Error` has conversions to and from `pset::Error`. So
if I re-export `encode::Error` I need to re-export `pset::Error`. (Also,
I just really want to; everything I *don't* re-export is a bunch of
extra explicit code that needs to stick around in this version of the
library. See above.)
4. But I need to explicitly construct `pset::Error` in the `Map::insert_pair`
impl for `pset::Output`. (This *can't* be re-exported because it's private,
and I can't re-export the whole `pset::Output` type because it has a method
which returns `TxOut`, whose API changed in 0.26.0.)
5. ...so I need a re-export of `PsetHash` to do the construction.1 parent 6da502c commit 45a6938
2 files changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
| 31 | + | |
30 | 32 | | |
| 33 | + | |
31 | 34 | | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
0 commit comments