rust-bitcoin / rust-secp256k1

Rust language bindings for Bitcoin secp256k1 library.
Creative Commons Zero v1.0 Universal
339 stars 260 forks source link

`PublicKey` and `XOnlyPublicKey` should not *derive* `Debug` #729

Open Kixunil opened 2 weeks ago

Kixunil commented 2 weeks ago

It should be manually implemented to show the key as serialized. Otherwise it shows just the internal data which, for the purpose of debugging, is just a garbage. See also: https://github.com/rust-bitcoin/rust-bitcoin/pull/3278

apoelstra commented 2 weeks ago

For the purpose of debugging, is it garbage? I guess it depends on what level you are debugging at. If you are debugging this library then presumably you want the raw representation.

Weak concept ACK, but I can see either side on this one.

Kixunil commented 2 weeks ago

If you really need to debug the internal representation you should use the FFI type which appropriately shows the internal representation. (But calling it out in the doc would be nice.)