Tobin C. Harding
761de886be
Remove imports of TryFrom and TryInto
...
Now that MSRV is Rust 1.56.1 we no longer need to explicitly import
`TryFrom` and `TryInto`.
No clue why clippy didn't find these for us.
2023-11-24 03:52:05 +11:00
Matt Corallo
2364e1a877
Stop relying on blanket Read impl for all &mut Read
2023-11-07 05:51:36 +00:00
Vincenzo Palazzo
98513ef151
clippy: more worning fixes
...
error[E0308]: mismatched types
--> bitcoin/src/psbt/raw.rs:87:24
|
87 | return Err(encode::Error::OversizedVectorAllocation {
| ________________________^
88 | | requested: key_byte_size as usize,
89 | | max: MAX_VEC_SIZE,
90 | | });
| |_____________^ expected enum `psbt::error::Error`, found enum `consensus::encode::Error`
|
help: try wrapping the expression in `psbt::error::Error::ConsensusEncoding`
|
87 ~ return Err(psbt::error::Error::ConsensusEncoding(encode::Error::OversizedVectorAllocation {
88 | requested: key_byte_size as usize,
89 | max: MAX_VEC_SIZE,
90 ~ }));
|
----
Compiling bitcoin v0.30.0 (/home/vincent/github/work/rust-btc/rust-bitcoin/bitcoin)
Checking bitcoin-fuzz v0.0.1 (/home/vincent/github/work/rust-btc/rust-bitcoin/fuzz)
error: redundant clone
--> bitcoin/examples/taproot-psbt.rs:453:77
|
453 | witness_utxo: { Some(TxOut { value, script_pubkey: script_pubkey.clone() }) },
| ^^^^^^^^ help: remove this
|
= note: `-D clippy::redundant-clone` implied by `-D warnings`
note: this value is dropped without further use
--> bitcoin/examples/taproot-psbt.rs:453:64
|
453 | witness_utxo: { Some(TxOut { value, script_pubkey: script_pubkey.clone() }) },
| ^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone
error: could not compile `bitcoin` due to previous error
warning: build failed, waiting for other jobs to finish...
error: redundant clone
--> bitcoin/src/psbt/mod.rs:1095:13
|
1095 | .clone()
| ^^^^^^^^ help: remove this
|
= note: `-D clippy::redundant-clone` implied by `-D warnings`
note: this value is dropped without further use
--> bitcoin/src/psbt/mod.rs:1094:17
|
1094 | assert!(psbt
| _________________^
1095 | | .clone()
| |____________^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-10-07 11:40:44 +02:00
Tobin C. Harding
0419fa278b
Add VarInt from implementations by way of macro
...
Throughout the codebase we cast values to `u64` when constructing a
`VarInt`. We can make the code marginally cleaner by adding `From<T>`
impls for all unsigned integer types less than or equal to 64 bits.
Also allows us to (possibly unnecessarily) comment the cast in a single
place.
2023-08-24 10:37:53 +10:00
Tobin C. Harding
a52746d01c
psbt: Run the formatter
...
Run `cargo +nightly fmt`, no other manual changes.
2023-03-21 08:33:23 +11:00
DanGould
e7bbfd3913
Improve Psbt error handling
...
Remove recursive dependence between encode::Error and psbt::Error.
Separate consensus encoding errors from Psbt application errors.
2023-01-17 16:43:39 -05:00
Andrew Poelstra
649bf023af
Merge rust-bitcoin/rust-bitcoin#1537 : Export the DisplayHex trait from within prelude
...
70fe07f1ce
Export the DisplayHex trait from within prelude (Tobin C. Harding)
Pull request description:
We use `internals::hex::display::DisplayHex` in many places, we can improve ergonomics of the `internals` crate by re-exporting it from the `prelude` module.
ACKs for top commit:
Kixunil:
ACK 70fe07f1ce
apoelstra:
ACK 70fe07f1ce
Tree-SHA512: 96a89135cb0b829b7b5926a3b344f78e178b5b48e772a69da5133fab6d2e14e7b7bbaa56b7a417a5c1a64337546a1c7bac32307d3a1f27aa199ed61f590902bf
2023-01-16 15:21:33 +00:00
DanGould
1a409ecc8e
Use &[u8] instead of Cursor as Read
2023-01-09 23:21:20 -05:00
Tobin C. Harding
70fe07f1ce
Export the DisplayHex trait from within prelude
...
We use `internals::hex::display::DisplayHex` in many places, we can
improve ergonomics of the `internals` crate by re-exporting it from the
`prelude` module.
2023-01-10 09:56:41 +11:00
Martin Habovstiak
1b0988833a
Remove `ToHex`
...
The `ToHex` trait was replaced by either simple `Display`/`LowerHex`
where appropriate or `DisplayHex` from `bitcoin_internals` which is
faster.
This change replaces the usages and removes the trait.
2023-01-07 19:50:03 +01:00
DanGould
c4363e5ba1
Deserialize Psbt fields, don't consensus_encode
2022-12-21 12:24:06 -05:00
DanGould
c1dd6ad8a2
Serialize Psbt fields, don't consensus_encode them
2022-12-21 12:19:38 -05: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