Skip to content

Commit 1f9fdb8

Browse files
committed
Merge #730: docs: fix new clippy lint about excessively long initial line
05dace0 docs: fix new clippy lint about excessively long initial line (Andrew Poelstra) Pull request description: Also does a few miscellaneous fixes that I noticed while fixing the lint. ACKs for top commit: tcharding: ACK 05dace0 sanket1729: ACK 05dace0 Tree-SHA512: d01fa4da51da2042a4f480096ca316b0d2a49955809f471779b060e9da00eac7051d49c3fb64c42b0791cb778a1cc01558e9f373c5020b8efccb88cb9c046884
2 parents e090fe9 + 05dace0 commit 1f9fdb8

File tree

8 files changed

+55
-24
lines changed

8 files changed

+55
-24
lines changed

src/miniscript/context.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ impl fmt::Display for ScriptContextError {
152152
}
153153
}
154154

155-
/// The ScriptContext for Miniscript. Additional type information associated with
155+
/// The ScriptContext for Miniscript.
156+
///
157+
/// Additional type information associated with
156158
/// miniscript that is used for carrying out checks that dependent on the
157159
/// context under which the script is used.
158160
/// For example, disallowing uncompressed keys in Segwit context

src/miniscript/satisfy.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use crate::{
2626
/// Type alias for 32 byte Preimage.
2727
pub type Preimage32 = [u8; 32];
2828
/// Trait describing a lookup table for signatures, hash preimages, etc.
29+
///
2930
/// Every method has a default implementation that simply returns `None`
3031
/// on every query. Users are expected to override the methods that they
3132
/// have data for.
@@ -58,7 +59,8 @@ pub trait Satisfier<Pk: MiniscriptKey + ToPublicKey> {
5859
/// Given a raw `Pkh`, lookup corresponding [`bitcoin::secp256k1::XOnlyPublicKey`]
5960
fn lookup_raw_pkh_x_only_pk(&self, _: &hash160::Hash) -> Option<XOnlyPublicKey> { None }
6061

61-
/// Given a keyhash, look up the EC signature and the associated key
62+
/// Given a keyhash, look up the EC signature and the associated key.
63+
///
6264
/// Even if signatures for public key Hashes are not available, the users
6365
/// can use this map to provide pkh -> pk mapping which can be useful
6466
/// for dissatisfying pkh.
@@ -69,7 +71,8 @@ pub trait Satisfier<Pk: MiniscriptKey + ToPublicKey> {
6971
None
7072
}
7173

72-
/// Given a keyhash, look up the schnorr signature and the associated key
74+
/// Given a keyhash, look up the schnorr signature and the associated key.
75+
///
7376
/// Even if signatures for public key Hashes are not available, the users
7477
/// can use this map to provide pkh -> pk mapping which can be useful
7578
/// for dissatisfying pkh.

src/miniscript/types/correctness.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ impl Input {
7272
}
7373
}
7474

75-
/// Structure representing the type properties of a fragment which are
76-
/// relevant to completeness (are all expected branches actually accessible,
77-
/// given some valid witness) and soundness (is it possible to satisfy the
78-
/// Script without satisfying one of the Miniscript branches).
75+
/// Soundness and completeness type properties of a fragment.
76+
///
77+
/// Completeness is the property that a valid witness actually exists for all
78+
/// branches, which an honest user can produce. Soundness is the property
79+
/// that no branch can be satisfied _without_ an honest user.
7980
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
8081
pub struct Correctness {
8182
/// The base type

src/miniscript/types/malleability.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
//! Malleability-related Type properties
44
55
/// Whether the fragment has a dissatisfaction, and if so, whether
6-
/// it is unique. Affects both correctness and malleability-freeness,
6+
/// it is unique.
7+
///
8+
/// Affects both correctness and malleability-freeness,
79
/// since we assume 3rd parties are able to produce dissatisfactions
810
/// for all fragments.
911
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
@@ -12,11 +14,15 @@ pub enum Dissat {
1214
/// input.
1315
None,
1416
/// Fragment has a unique dissatisfaction, which is always available,
15-
/// and will push 0 given this dissatisfaction as input. The combination
17+
/// and will push 0 given this dissatisfaction as input.
18+
///
19+
/// The combination
1620
/// of `Dissat::Unique` and `Input::Zero` implies that a fragment is
1721
/// impossible to satisfy (is a `0` or equivalent).
1822
Unique,
19-
/// No assumptions may be made about dissatisfying this fragment. This
23+
/// No assumptions may be made about dissatisfying this fragment.
24+
///
25+
/// This
2026
/// does not necessarily mean that there are multiple dissatisfactions;
2127
/// there may be none, or none that are always available (e.g. for a
2228
/// `pk_h` the key preimage may not be available).
@@ -52,8 +58,9 @@ pub struct Malleability {
5258
/// Properties of dissatisfying inputs
5359
pub dissat: Dissat,
5460
/// `true` if satisfactions cannot be created by any 3rd party
55-
/// who has not yet seen a satisfaction. (Hash preimages and
56-
/// signature checks are safe; timelocks are not.) Affects
61+
/// who has not yet seen a satisfaction.
62+
///
63+
/// Hash preimages and signature checks are safe; timelocks are not. Affects
5764
/// malleability.
5865
pub safe: bool,
5966
/// Whether a non-malleable satisfaction is guaranteed to exist for
@@ -69,7 +76,8 @@ impl Malleability {
6976
pub const FALSE: Self =
7077
Malleability { dissat: Dissat::Unique, safe: true, non_malleable: true };
7178

72-
/// Check whether the `self` is a subtype of `other` argument .
79+
/// Check whether the `self` is a subtype of `other` argument.
80+
///
7381
/// This checks whether the argument `other` has attributes which are present
7482
/// in the given `Type`. This returns `true` on same arguments
7583
/// `a.is_subtype(a)` is `true`.

src/miniscript/types/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: CC0-1.0
22

33
//! Miniscript Types
4+
//!
45
//! Contains structures representing Miniscript types and utility functions
56
//! Contains all the type checking rules for correctness and malleability
67
//! Implemented as per rules on bitcoin.sipa.be/miniscript

src/plan.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// SPDX-License-Identifier: CC0-1.0
22

3-
//! A spending plan or *plan* for short is a representation of a particular spending path on a
4-
//! descriptor. This allows us to analayze a choice of spending path without producing any
3+
//! A spending plan (or *plan*) is a representation of a particular spending path on a
4+
//! descriptor.
5+
//!
6+
//! This allows us to analayze a choice of spending path without producing any
57
//! signatures or other witness data for it.
68
//!
79
//! To make a plan you provide the descriptor with "assets" like which keys you are able to use, hash
@@ -67,7 +69,9 @@ pub trait AssetProvider<Pk: MiniscriptKey> {
6769
}
6870

6971
/// Given a keyhash, look up the EC signature and the associated key.
72+
///
7073
/// Returns the key if a signature is found.
74+
///
7175
/// Even if signatures for public key Hashes are not available, the users
7276
/// can use this map to provide pkh -> pk mapping which can be useful
7377
/// for dissatisfying pkh.
@@ -76,7 +80,9 @@ pub trait AssetProvider<Pk: MiniscriptKey> {
7680
}
7781

7882
/// Given a keyhash, look up the schnorr signature and the associated key.
83+
///
7984
/// Returns the key and sig len if a signature is found.
85+
///
8086
/// Even if signatures for public key Hashes are not available, the users
8187
/// can use this map to provide pkh -> pk mapping which can be useful
8288
/// for dissatisfying pkh.
@@ -211,7 +217,9 @@ where
211217
fn check_after(&self, l: absolute::LockTime) -> bool { Satisfier::check_after(self, l) }
212218
}
213219

214-
/// Representation of a particular spending path on a descriptor. Contains the witness template
220+
/// Representation of a particular spending path on a descriptor.
221+
///
222+
/// Contains the witness template
215223
/// and the timelocks needed for satisfying the plan.
216224
/// Calling `plan` on a Descriptor will return this structure,
217225
/// containing the cheapest spending path possible (considering the `Assets` given)
@@ -499,7 +507,9 @@ impl TaprootAvailableLeaves {
499507
/// The Assets we can use to satisfy a particular spending path
500508
#[derive(Debug, Default)]
501509
pub struct Assets {
502-
/// Keys the user can sign for, and how. A pair `(fingerprint, derivation_path)` is
510+
/// Keys the user can sign for, and how.
511+
///
512+
/// A pair `(fingerprint, derivation_path)` is
503513
/// provided, meaning that the user can sign using the key with `fingerprint`,
504514
/// derived with either `derivation_path` or a derivation path that extends `derivation_path`
505515
/// by exactly one child number. For example, if the derivation path `m/0/1` is provided, the

src/psbt/finalizer.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Written in 2020 by Sanket Kanjalkar <[email protected]>
22
// SPDX-License-Identifier: CC0-1.0
33

4-
//! # Partially-Signed Bitcoin Transactions
4+
//! Partially-Signed Bitcoin Transactions
55
//!
66
//! This module implements the Finalizer and Extractor roles defined in
77
//! BIP 174, PSBT, described at
@@ -298,7 +298,8 @@ fn get_descriptor(psbt: &Psbt, index: usize) -> Result<Descriptor<PublicKey>, In
298298
}
299299

300300
/// Interprets all psbt inputs and checks whether the
301-
/// script is correctly interpreted according to the context
301+
/// script is correctly interpreted according to the context.
302+
///
302303
/// The psbt must have included final script sig and final witness.
303304
/// In other words, this checks whether the finalized psbt interprets
304305
/// correctly
@@ -351,7 +352,9 @@ fn interpreter_inp_check<C: secp256k1::Verification, T: Borrow<TxOut>>(
351352
Ok(())
352353
}
353354

354-
/// Finalize the psbt. This function takes in a mutable reference to psbt
355+
/// Finalize the psbt.
356+
///
357+
/// This function takes in a mutable reference to psbt
355358
/// and populates the final_witness and final_scriptsig
356359
/// of the psbt assuming all of the inputs are miniscript as per BIP174.
357360
/// If any of the inputs is not miniscript, this returns a parsing error

src/psbt/mod.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,9 @@ impl From<bitcoin::key::FromSliceError> for InputError {
235235
fn from(e: bitcoin::key::FromSliceError) -> InputError { InputError::KeyErr(e) }
236236
}
237237

238-
/// Psbt satisfier for at inputs at a particular index
239-
/// Takes in &psbt because multiple inputs will share
238+
/// Psbt satisfier for at inputs at a particular index.
239+
///
240+
/// Holds a `&psbt` because multiple inputs may share
240241
/// the same psbt structure
241242
/// All operations on this structure will panic if index
242243
/// is more than number of inputs in pbst
@@ -510,8 +511,10 @@ pub trait PsbtExt {
510511
) -> Result<Psbt, (Psbt, Error)>;
511512

512513
/// Psbt extractor as defined in BIP174 that takes in a psbt reference
513-
/// and outputs a extracted bitcoin::Transaction
514-
/// Also does the interpreter sanity check
514+
/// and outputs a extracted [`bitcoin::Transaction`].
515+
///
516+
/// Also does the interpreter sanity check.
517+
///
515518
/// Will error if the final ScriptSig or final Witness are missing
516519
/// or the interpreter check fails.
517520
fn extract<C: secp256k1::Verification>(

0 commit comments

Comments
 (0)