smplx_sdk_test/transaction/
change_output.rs1use elements_miniscript::bitcoin::PublicKey;
2
3use simplicityhl::elements::Script;
4
5#[derive(Debug, Clone)]
9pub struct ChangeOutput {
10 pub script_pubkey: Script,
12 pub blinding_key: Option<PublicKey>,
14}
15
16impl ChangeOutput {
17 #[must_use]
19 pub fn new(script_pubkey: Script) -> Self {
20 Self {
21 script_pubkey,
22 blinding_key: None,
23 }
24 }
25
26 #[must_use]
28 pub fn with_blinding_key(mut self, blinding_key: PublicKey) -> Self {
29 self.blinding_key = Some(blinding_key);
30
31 self
32 }
33}
34
35#[cfg(test)]
36mod tests {
37 use super::*;
38
39 #[test]
40 fn change_output_defaults_to_explicit_change() {
41 let change = ChangeOutput::new(Script::new());
42
43 assert!(change.blinding_key.is_none());
44 }
45}