Conversation
ef9007e to
a1d15f8
Compare
| #[deprecated(since = "TBD", note = "use `FullPublicKey` instead")] | ||
| #[doc(hidden)] | ||
| pub type CompressedPublicKey = FullPublicKey; |
There was a problem hiding this comment.
Why did you create this alias twice instead of re-exporting the other one? (Here and also in key module)
There was a problem hiding this comment.
Two reasons:
- If you re-export the alias that is marked as deprecated, it throws a lint warning on the
pub usestatement. - I was following the precedent of
BlockInterval. It is defined in bothlib.rsandblock.rsinbitcoin, presumably to avoid the above lint error.
There was a problem hiding this comment.
No worries, @apoelstra git blame says 4e4601b was you. Do you remember doing this intentionally?
There was a problem hiding this comment.
No, I don't remember. I suspect I was trying to dance around the compiler's stupid broken deprecation logic somehow.
|
I wonder if we should keep the re-exports of the deprecated keys everywhere so that users of the old names get the deprecation warning but their code still builds? |
|
Reviewed: a1d15f8 |
a1d15f8 to
ae5d512
Compare
ae5d512 to
9566a19
Compare
|
Reviewed: 9566a19 Note to self: Waiting on resolution of "should we use two separate type alias'" |
|
9566a19 needs rebase |
The CompressedPublicKey represents an always compressed ECDSA public key. This key type is the standard for almost all transactions in modern Bitcoin. As such, it should be renamed to better clarify its purpose. Rename CompressedPublicKey to FullPublicKey. Deprecate CompressedPublicKey.
The senders_keys function in sign-tx-segwit uses a LegacyPublicKey to generate the WPubkeyHash. Since a FullPublicKey can generate the same hash without the fallibility, it's better for the example to use it here. Replace PublicKey with FullPublicKey in senders_keys function in sign-tx-segwit-v0 example.
The optionally-compressed PublicKey type is no longer used in Bitcoin outside of legacy transaction handling. Since the name PublicKey implies a general purpose public key type, it should be renamed to clarify the niche use compared to the typical compressed public key type, FullPublicKey. Rename PublicKey to LegacyPublicKey. Deprecate PublicKey.
9566a19 to
25941bc
Compare
As has been mentioned before, the public key types PublicKey and CompressedPublicKey don't correctly convey the intended usages for the types. The optionally-compressed PublicKey type is intended to be used for legacy transactions, replaced almost entirely by the CompressedPublicKey. To this end, both of the types should be renamed to better outline their usage, rather than their implementation.