Skip to content

Commit 14833b0

Browse files
Improve the AssetProvider docs
1 parent 6151612 commit 14833b0

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
@@ -33,15 +33,17 @@ use crate::{DefiniteDescriptorKey, DescriptorPublicKey, Error, MiniscriptKey, To
3333

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

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

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

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

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

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

0 commit comments

Comments
 (0)