From: Elias Rohrer Date: Tue, 16 Apr 2024 09:12:43 +0000 (+0200) Subject: Introduce `ChangeDestinationSource` trait X-Git-Tag: v0.0.123-beta~6^2~5 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=cd4cc203a2bbb716c8747bd45ac84e42b8f53b84;p=rust-lightning Introduce `ChangeDestinationSource` trait .. which users should implement on their on-chain wallet to allow us to retrieve a new change destination script. --- diff --git a/lightning/src/sign/mod.rs b/lightning/src/sign/mod.rs index 1459151de..9b5efee4b 100644 --- a/lightning/src/sign/mod.rs +++ b/lightning/src/sign/mod.rs @@ -904,6 +904,17 @@ pub trait SignerProvider { fn get_shutdown_scriptpubkey(&self) -> Result; } +/// A helper trait that describes an on-chain wallet capable of returning a (change) destination +/// script. +pub trait ChangeDestinationSource { + /// Returns a script pubkey which can be used as a change destination for + /// [`OutputSpender::spend_spendable_outputs`]. + /// + /// 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(&self) -> Result; +} + /// A simple implementation of [`WriteableEcdsaChannelSigner`] that just keeps the private keys in memory. /// /// This implementation performs no policy checks and is insufficient by itself as