Commit Graph

14 Commits

Author SHA1 Message Date
Lorenzo Maturano 673ca2d2fe changing docs and examples to use reference to slice in `derive_pub` 2023-02-21 14:34:14 -03:00
Tobin C. Harding a308e1e2ea
Remove FromHex for all types except Vec and array
Remove `FromHex` from hash and script types

- Remove the `FromHex` implementation from hash types and `ScriptBuf`
- Remove the `FromStr` implementation from `ScriptBuf` because it does not
  roundtrip with `Display`.
- Implement a method `from_hex` on `ScriptBuf`.
- Implement `FromStr` on hash types using a fixed size array.

This leaves `FromHex` implementations only on `Vec` and fixed size arrays.
2023-02-01 08:26:46 +11:00
Jiri Jakes bef7c6e687 Use marker type to enforce validation of `Address`'s network
Parsing addresses from strings required a subsequent validation of
network of the parsed address. However, this validation was not
enforced by compiler, one had to remember to perform it.

This change adds a marker type to `Address` that will assist the
compiler in enforcing this validation.
2023-01-11 19:27:10 +08:00
DanGould c1dd6ad8a2
Serialize Psbt fields, don't consensus_encode them 2022-12-21 12:19:38 -05:00
Martin Habovstiak 8e428562cb Implemented unsized `Script`
This renames `Script` to `ScriptBuf` and adds unsized `Script` modeled
after `PathBuf`/`Path`. The change cleans up the API a bit, especially
all functions that previously accepted `&Script` now accept truly
borrowed version. Some functions that perviously accepted `&[u8]` can
now accept `&Script` because constructing it is no loger costly.
2022-12-14 23:21:27 +01:00
Andrew Poelstra 5b7d801ee6
remove PackedLockTime type
This can be replicated by deleting the `type PackedLockTime = LockTime'
line, and then running
    find . -type f | xargs sed -i 's/PackedLockTime/LockTime/g
at the root of the repo.
2022-12-11 19:08:14 +00:00
Tobin C. Harding 408d7737fb Run cargo fmt
Run the command `cargo +nightly fmt` to fix formatting issues. No other
changes other than those introduced by `rustfmt`.
2022-11-18 13:11:07 +11:00
Tobin C. Harding 30888f74c5 Move psbt module to crate root module
Move the `psbt` module out of `util` and into the crate root module.
Done as part of an effort to clean up `util`.
2022-11-16 10:43:35 +11:00
Tobin C. Harding 49d7b0bfe1 Remove deprecated re-exports
Recently we added a bunch of deprecated re-exports while moving things
out of the util module. Turns out while the code reads like it works,
`deprecated` actually only works for functions, not types or modules
etc.

Remove the non-functional deprecated lines and elect to _not_ re-export
things we moved. Release 0.30 is going to break a lot of code but there
is no real nice way to resolve that. We will need good release notes and
a public apology probably :)

Fix import statements that still rely on `util::bip32` - these should
have been fixed when we moved the `bip32` module.
2022-11-08 11:55:35 +11:00
DanGould b8bd31d5a8
Promote rust-miniscript finalizer 2022-10-27 10:40:45 -04:00
Tobin C. Harding dd8730e14f Use new PSBT signing API in example
We have a PSBT example that includes a custom signing module, we can
remove that now and use the new PSBT signing API.
2022-10-20 06:07:53 +11:00
Tobin C. Harding 4057c26829 Run formmater on bip152
Run the formmater on the newly moved `bip152` module. No changes other
than those introduced by `cargo +nightly fmt`.
2022-10-19 06:41:10 +11:00
Tobin C. Harding 2001f44e46 Try to fix up sighash export mess
Recently we moved a few types from `transaction` to `sighash`, while
doing so I erroneously annotated code with the `deprecated` attribute
hoping it would give downstream users a gentle upgrade experience. It
turns out `deprecated` only works on functions.

During that same work, we re-exported from the crate root a bunch of
types from the `sighash` module that probably should not have been
re-exported. We are currently trying to create a nice clean API surface,
in an effort to move in the right direction we should remove the
re-exports and just re-export the `sighash` module.

Try to clean up the sighash export mess by doing:

- Remove the re-exports from the `transaction` module
- Remove crate level re-exports of `sighash` module types
- Re-export `sighash` module

Note, this patch is a breaking API change, justified by the fact that
there is no good way to gently lead downstream when moving types since
types cannot be deprecated with the `deprecated` attribute.
2022-09-19 16:46:02 +10:00
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
Renamed from examples/ecdsa-psbt.rs (Browse further)