Commit Graph

5 Commits

Author SHA1 Message Date
Tobin C. Harding 022730bd8d Add a workspace to the top level directory.
Create a directory `bitcoin` and move into it the following as is with
no code changes:

- src
- Cargo.toml
- contrib
- test_data
- examples

Then do:

- Add a workspace to the repository root directory.
- Add the newly created `bitcoin` crate to the workspace.
- Exclude `fuzz` and `embedded` crates from the workspace.
- Add a contrib/test.sh script that runs contrib/test.sh in each
  sub-crate
- Fix the bitcoin/contrib/test.sh script
2022-09-13 08:44:57 +10:00
Tobin C. Harding 6cc8b22f82 Run cargo fmt
We have formatting issues on master because we do not yet run the
formatter in CI (PR is open).

We are about to move the `address` module to `/src` which will require
running the formatter.

Run `cargo fmt` to fix formatting issues, no other changes.
2022-08-12 07:35:15 +10:00
Martin Habovstiak 94eeabfd6c Remove accidentally-exported internal macros
Closes #1176
2022-08-11 11:10:56 +02:00
Martin Habovstiak 071a1c02b7 Implement string parsing for `Sequence`
`Sequence` didn't have `FromStr` nor `TryFrom<{stringly type}>`
implemented by accident. This moves a macro for implementing them from
`locktime` module to the `parse` module, renames it for clarity and uses
it to implement parsing for `Sequence`.
2022-07-27 20:46:37 +02:00
Martin Habovstiak c39bc3909d Extend `ParseIntError` to carry more context
When debugging parsing errors it's very useful to know some context:
what the input was and what integer type was parsed. `ParseIntError`
from `core` doesn't contain this information.

In this commit a custom `ParseIntError` type is crated that carries the
one from `core` as well as additional information. Its `Display`
implementation displays this additional information as a well-formed
English sentence to aid users with understanding the problem. A helper
function parses any integer type from common string types returning the
new `ParseIntError` type on error.

To clean up the error code a bit some new macros are added and used.
New modules are added to organize the types, functions and macros.

Closes #1113
2022-07-27 18:51:53 +02:00