Skip to content

Commit 1e927fa

Browse files
committed
Merge commit 'b6daa9786a9e0479df9f7abd4570e319b0a6637e' into update_2022_10
b6daa97 Merge rust-bitcoin/rust-miniscript#463: Fix inconsistent naming in the dummy key hash structs Export structs from upstream instead
2 parents 6f19281 + b6daa97 commit 1e927fa

File tree

3 files changed

+8
-82
lines changed

3 files changed

+8
-82
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ rand = ["bitcoin/rand"]
1818
[dependencies]
1919
bitcoin = "0.29.1"
2020
elements = "0.21.0"
21-
bitcoin-miniscript = {package = "miniscript", git = "https://github.com/rust-bitcoin/rust-miniscript", rev = "cddc22df7f678563d0314437c2ab88acfa154200"}
21+
bitcoin-miniscript = {package = "miniscript", git = "https://github.com/rust-bitcoin/rust-miniscript", rev = "b6daa9786a9e0479df9f7abd4570e319b0a6637e"}
2222

2323
# Do NOT use this as a feature! Use the `serde` feature instead.
2424
actual-serde = { package = "serde", version = "1.0", optional = true }

contrib/test.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ if cargo --version | grep "1\.41\.0"; then
1616
MSRV=true
1717
fi
1818

19+
if cargo --version | grep "1\.47\.0"; then
20+
cargo update -p once_cell --precise 1.13.1
21+
fi
22+
1923
# form_urlencoded 1.1.0 breaks MSRV.
2024
if [ "$MSRV" = true ]; then
2125
cargo update -p url --precise 2.2.2

src/lib.rs

Lines changed: 3 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ pub(crate) use bitcoin_miniscript::policy::semantic::Policy as BtcPolicy;
125125
pub(crate) use bitcoin_miniscript::policy::Liftable as BtcLiftable;
126126
// re-export imports
127127
pub use bitcoin_miniscript::{
128-
hash256, DummyKey, DummyKeyHash, ForEachKey, MiniscriptKey, ToPublicKey,
128+
hash256, DummyHash160Hash, DummyHash256Hash, DummyKey, DummyKeyHash, DummyRipemd160Hash,
129+
DummySha256Hash, ForEachKey, MiniscriptKey, ToPublicKey,
129130
};
130131
pub(crate) use bitcoin_miniscript::{
131132
Descriptor as BtcDescriptor, Error as BtcError, Miniscript as BtcMiniscript,
@@ -148,7 +149,7 @@ pub mod psbt;
148149
mod test_utils;
149150
mod util;
150151

151-
use std::{error, fmt, hash, str};
152+
use std::{error, fmt, str};
152153

153154
use elements::hashes::sha256;
154155
use elements::secp256k1_zkp::Secp256k1;
@@ -216,85 +217,6 @@ where
216217
contracthash::tweak_key(secp, pk, contract)
217218
}
218219

219-
/// Dummy keyhash which de/serializes to the empty string; useful for testing
220-
#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Debug)]
221-
pub struct DummyHash256;
222-
223-
impl str::FromStr for DummyHash256 {
224-
type Err = &'static str;
225-
fn from_str(x: &str) -> Result<DummyHash256, &'static str> {
226-
if x.is_empty() {
227-
Ok(DummyHash256)
228-
} else {
229-
Err("non empty dummy hash")
230-
}
231-
}
232-
}
233-
234-
/// Dummy keyhash which de/serializes to the empty string; useful for testing
235-
#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Debug)]
236-
pub struct DummyRipemd160Hash;
237-
238-
impl str::FromStr for DummyRipemd160Hash {
239-
type Err = &'static str;
240-
fn from_str(x: &str) -> Result<DummyRipemd160Hash, &'static str> {
241-
if x.is_empty() {
242-
Ok(DummyRipemd160Hash)
243-
} else {
244-
Err("non empty dummy hash")
245-
}
246-
}
247-
}
248-
249-
impl fmt::Display for DummyHash256 {
250-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
251-
f.write_str("")
252-
}
253-
}
254-
impl fmt::Display for DummyRipemd160Hash {
255-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
256-
f.write_str("")
257-
}
258-
}
259-
260-
impl hash::Hash for DummyHash256 {
261-
fn hash<H: hash::Hasher>(&self, state: &mut H) {
262-
"DummySha256Hash".hash(state);
263-
}
264-
}
265-
266-
impl hash::Hash for DummyRipemd160Hash {
267-
fn hash<H: hash::Hasher>(&self, state: &mut H) {
268-
"DummyRipemd160Hash".hash(state);
269-
}
270-
}
271-
272-
/// Dummy keyhash which de/serializes to the empty string; useful for testing
273-
#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Debug)]
274-
pub struct DummyHash160Hash;
275-
276-
impl str::FromStr for DummyHash160Hash {
277-
type Err = &'static str;
278-
fn from_str(x: &str) -> Result<DummyHash160Hash, &'static str> {
279-
if x.is_empty() {
280-
Ok(DummyHash160Hash)
281-
} else {
282-
Err("non empty dummy hash")
283-
}
284-
}
285-
}
286-
287-
impl fmt::Display for DummyHash160Hash {
288-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
289-
f.write_str("")
290-
}
291-
}
292-
293-
impl hash::Hash for DummyHash160Hash {
294-
fn hash<H: hash::Hasher>(&self, state: &mut H) {
295-
"DummyHash160Hash".hash(state);
296-
}
297-
}
298220
/// Describes an object that can translate various keys and hashes from one key to the type
299221
/// associated with the other key. Used by the [`TranslatePk`] trait to do the actual translations.
300222
pub trait Translator<P, Q, E>

0 commit comments

Comments
 (0)