Skip to content

Commit

Permalink
plan: make LoggerAssetProvider constructible
Browse files Browse the repository at this point in the history
It looks like we have an example AssetProvider that is intended to be
used for testing/debugging. It looks useful but evidently has never been
used because it was impossible to construct.

Recent versions of rust nightly notice this and output a warning about
this, which is causing CI to fail, so we need to fix it.

My solution is to make the inner `Assets` public (and also a reference,
since there is no need to take ownership) so that people can easily
construct and deconstruct the type.
  • Loading branch information
apoelstra committed Jun 15, 2024
1 parent 9e1b3cd commit b39b707
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub trait AssetProvider<Pk: MiniscriptKey> {

/// Wrapper around [`Assets`] that logs every query and value returned
#[cfg(feature = "std")]
pub struct LoggerAssetProvider(Assets);
pub struct LoggerAssetProvider<'a>(pub &'a Assets);

#[cfg(feature = "std")]
macro_rules! impl_log_method {
Expand All @@ -123,7 +123,7 @@ macro_rules! impl_log_method {
}

#[cfg(feature = "std")]
impl AssetProvider<DefiniteDescriptorKey> for LoggerAssetProvider {
impl<'a> AssetProvider<DefiniteDescriptorKey> for LoggerAssetProvider<'a> {
impl_log_method!(provider_lookup_ecdsa_sig, pk: &DefiniteDescriptorKey, -> bool);
impl_log_method!(provider_lookup_tap_key_spend_sig, pk: &DefiniteDescriptorKey, -> Option<usize>);
impl_log_method!(provider_lookup_tap_leaf_script_sig, pk: &DefiniteDescriptorKey, leaf_hash: &TapLeafHash, -> Option<usize>);
Expand Down

0 comments on commit b39b707

Please sign in to comment.