Skip to content

Commit 5a76fe0

Browse files
Improve the AssetProvider docs
1 parent e396c80 commit 5a76fe0

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/plan.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,17 @@ use crate::{DefiniteDescriptorKey, DescriptorPublicKey, Error, MiniscriptKey, To
3434

3535
/// Trait describing a present/missing lookup table for constructing witness templates
3636
///
37-
/// This trait mirrors the [`Satisfier`] trait with the difference that instead of returning the
38-
/// item if it's present, it only returns a boolean to indicate its presence.
37+
/// This trait mirrors the [`Satisfier`] trait, with the difference that most methods just return a
38+
/// boolean indicating the item presence. The methods looking up keys return the key
39+
/// length, the methods looking up public key hashes return the public key, and a few other methods
40+
/// need to return the item itself.
3941
///
4042
/// This trait is automatically implemented for every type that is also a satisfier, and simply
4143
/// proxies the queries to the satisfier and returns whether an item is available or not.
4244
///
43-
/// All the methods have a default implementation that returns `false`.
45+
/// All the methods have a default implementation that returns `false` or `None`.
4446
pub trait AssetProvider<Pk: MiniscriptKey> {
45-
/// Given a public key, look up an ECDSA signature with that key
47+
/// Given a public key, look up an ECDSA signature with that key, return whether we found it
4648
fn provider_lookup_ecdsa_sig(&self, _: &Pk) -> bool {
4749
false
4850
}
@@ -52,7 +54,7 @@ pub trait AssetProvider<Pk: MiniscriptKey> {
5254
None
5355
}
5456

55-
/// Given a public key and a associated leaf hash, look up an schnorr signature with that key
57+
/// Given a public key and a associated leaf hash, look up a schnorr signature with that key
5658
/// and return its size
5759
fn provider_lookup_tap_leaf_script_sig(&self, _: &Pk, _: &TapLeafHash) -> Option<usize> {
5860
None
@@ -96,22 +98,22 @@ pub trait AssetProvider<Pk: MiniscriptKey> {
9698
None
9799
}
98100

99-
/// Given a SHA256 hash, look up its preimage
101+
/// Given a SHA256 hash, look up its preimage, return whether we found it
100102
fn provider_lookup_sha256(&self, _: &Pk::Sha256) -> bool {
101103
false
102104
}
103105

104-
/// Given a HASH256 hash, look up its preimage
106+
/// Given a HASH256 hash, look up its preimage, return whether we found it
105107
fn provider_lookup_hash256(&self, _: &Pk::Hash256) -> bool {
106108
false
107109
}
108110

109-
/// Given a RIPEMD160 hash, look up its preimage
111+
/// Given a RIPEMD160 hash, look up its preimage, return whether we found it
110112
fn provider_lookup_ripemd160(&self, _: &Pk::Ripemd160) -> bool {
111113
false
112114
}
113115

114-
/// Given a HASH160 hash, look up its preimage
116+
/// Given a HASH160 hash, look up its preimage, return whether we found it
115117
fn provider_lookup_hash160(&self, _: &Pk::Hash160) -> bool {
116118
false
117119
}

0 commit comments

Comments
 (0)