Commit Graph

10 Commits

Author SHA1 Message Date
Andrew Poelstra 03d67dd1da
Merge rust-bitcoin/rust-bitcoin#1340: Move sighash module to crate root
fd7f8daeff Move sighash module to crate root (Tobin C. Harding)

Pull request description:

  Done as part of the effort to flatten the `util` module.

  The `sighash` module can stand alone in the crate root, it provides a discreet set of functionality - the `SighashCache` and associated types.

  Marking as high priority because this is part of flattening `util` which is a required step before we start crate smashing.

ACKs for top commit:
  Kixunil:
    ACK fd7f8daeff
  apoelstra:
    ACK fd7f8daeff

Tree-SHA512: e812ca903f7dccfa5a06084e23f93f617d016583bdf082d7a36ca8e67e49f1d140a3e138b93939e816861460ff2c04d49d5e37a555dd853dca1c76dbccd910bf
2022-10-25 00:57:43 +00:00
Tobin C. Harding fd7f8daeff Move sighash module to crate root
Done as part of the effort to flatten the `util` module.

The `sighash` module can stand alone in the crate root, it provides a
discreet set of functionality - the `SighashCache` and associated types.
2022-10-25 09:14:01 +11:00
hashmap c34d5f8f85
Implement PartiallySignedTransaction::fee
to calculate fee if previous outputs are available.
2022-10-24 14:39:32 +02:00
Tobin C. Harding d2367fb187 Add PSBT sign functionality
Signing a PSBT requires no knowledge other than what we have here in
this library and the PSBT ready to be signed.

This code was pulled out of `rust-miniscript`.

Add a `sign` method to the `PartiallySignedTransaction`.
2022-10-20 06:07:35 +11:00
Tobin C. Harding b80e5aeaab Re-order import statements
The import statements in `psbt/mod.rs` are a bit of a mess, re-order
them in an attempt to group like things and separate out things that are
different (e.g. `pub use` from `use`).

Refactor only, no logic changes.
2022-10-20 05:59:43 +11:00
Andrew Poelstra 7228d1fc14
Merge rust-bitcoin/rust-bitcoin#1299: Fix clippy warnings
f5412e2aa2 Fix clippy warnings (Tobin C. Harding)

Pull request description:

  Clippy recently upgraded and a few two new warnings types popped up in our codebase, fix them both in a single patch so CI passes for all commits.

  1. Remove unneeded explicit borrow
  2. Use `if let Some` instead of pattern match

ACKs for top commit:
  apoelstra:
    ACK f5412e2aa2
  Kixunil:
    ACK f5412e2aa2

Tree-SHA512: 1faeb6173061e28a1acfe1a37a669982abbd832b327448e31648c447a7d043841edf30349700ff9da9dd330cfa6d497d188534daab825069e4489653e25987ca
2022-09-26 19:18:25 +00:00
Tobin C. Harding f5412e2aa2 Fix clippy warnings
Clippy recently upgraded and a few two new warnings types popped up in
our codebase, fix them both in a single patch so CI passes for all
commits.

1. Remove unneeded explicit borrow
2. Use `if let Some` instead of pattern match
2022-09-26 17:00:12 +10: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 834bbf461f Introduce bitcoin-internals crate
Add a new crate `bitcoin-internals` to be used for internal code needed
by multiple soon-to-be-created crates.

Add the `write_err` macro to `bitcoin-internals`, nothing else.

This patch uses a `path` dependency which means `rust-bitcoin` cannot be
released in its current state, will need to be changed once we release
the `bitcoin-internals` crate on `crates.io`.
2022-09-13 08:59:57 +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 src/util/psbt/mod.rs (Browse further)