rust-bitcoin-unsafe-fast/bitcoin
Martin Habovstiak 93dba898c2 Improve lock time errors
The errors returned from various lock time functions had several issues.
Among the obvious - `Error` being returned from all operations even when
some of its variants were unreachable, there were subtle issues around
error messages:

* `ParseIntError` didn't contain information whether the parsed object
   is `Height` or `Time`.
* Logically overflow and out-of-bounds should be the same thing but
  produced different error messages.
* Mentioning integers is too technical for a user, talking about upper
  and lower bound is easier to understand.
* When minus sign is present `std` reports it as invalid digit which is
  less helpful than saying negative numbers are not allowed.

It is also possible that `ParseIntError` will need to be removed from
public API during crate smashing or stabilization, so avoiding it may be
better.

This commit significantly refactors the errors. It adds separate types
for parsing `Height` and `Time`. Notice that we don't compose them from
`ParseIntError` and `ConversionError` - that's not helpful because they
carry information that wouldn't be used when displaying which is
wasteful. Keeping errors small can be important.

It's also worth noting that exposing the inner representation could
cause confusion since the same thing: out of bounds can be represented
as an overflow or as a conversion error. So for now we conservatively
hide the details and even pretend there's no `source` in case of
overflow. This can be expanded in the future if needed.

The returned errors are now minimal. `LockTime` parsing errors are
currentlly unchanged.
2024-01-31 15:13:56 +01:00
..
contrib Remove DO_COV 2024-01-23 14:27:10 +11:00
embedded Implement `CompressedPublicKey` 2023-12-12 15:16:16 +01:00
examples Merge rust-bitcoin/rust-bitcoin#2402: Remove TODOs 2024-01-25 15:06:28 +00:00
src Improve lock time errors 2024-01-31 15:13:56 +01:00
tests Improve Signature field names 2024-01-15 10:26:40 +11:00
CHANGELOG.md Remove no-std feature 2023-12-06 09:54:33 +11:00
Cargo.toml Implement ArbitaryOrd for absolute::LockTime 2024-01-09 13:15:29 +11:00
build.rs Bump MSRV to Rust version 1.56.1 2023-11-23 06:20:02 +11:00