Give the `get_change_destination_script` future access to `self`
What changed, and why it matters
This is a small Rust API cleanup. It changes one method signature so that the future it returns can safely borrow from the object it is called on. There is no security bug being fixed and no behavior change for callers.
No security action needed. Treat as a normal API ergonomics patch.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies the ChangeDestinationSource::get_change_destination_script trait method and its wrapper implementation to take &'a self instead of &self. This ties the returned AsyncResult<'a, ScriptBuf> lifetime to self, allowing async implementations to borrow from self. The commit message frames this as a usability improvement for trait implementers, not a security fix. No call sites are changed because the lifetime is already compatible.
Changed components
lightning/src/sign/mod.rs: ChangeDestinationSource traitlightning/src/sign/mod.rs: ChangeDestinationSourceSyncWrapper implementationInspect captured patch +2 / −2
diff --git a/lightning/src/sign/mod.rs b/lightning/src/sign/mod.rs
index c0bbb94..f58a829 100644
--- a/lightning/src/sign/mod.rs
+++ b/lightning/src/sign/mod.rs
@@ -1041,7 +1041,7 @@ pub trait ChangeDestinationSource {
///
/// This method should return a different value each time it is called, to avoid linking
/// on-chain funds controlled to the same user.
- fn get_change_destination_script<'a>(&self) -> AsyncResult<'a, ScriptBuf>;
+ fn get_change_destination_script<'a>(&'a self) -> AsyncResult<'a, ScriptBuf>;
}
/// A synchronous helper trait that describes an on-chain wallet capable of returning a (change) destination script.
@@ -1073,7 +1073,7 @@ impl<T: Deref> ChangeDestinationSource for ChangeDestinationSourceSyncWrapper<T>
where
T::Target: ChangeDestinationSourceSync,
{
- fn get_change_destination_script<'a>(&self) -> AsyncResult<'a, ScriptBuf> {
+ fn get_change_destination_script<'a>(&'a self) -> AsyncResult<'a, ScriptBuf> {
let script = self.0.get_change_destination_script();
Box::pin(async move { script })
}
Why this scored 13/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.