]> Untitled Git - bdk/commitdiff
[keys] Make `GenerateKey<K>` clonable if K is
authorAlekos Filini <alekos.filini@gmail.com>
Wed, 13 Apr 2022 10:55:23 +0000 (12:55 +0200)
committerAlekos Filini <alekos.filini@gmail.com>
Wed, 13 Apr 2022 10:55:23 +0000 (12:55 +0200)
src/keys/mod.rs

index a21a0c970f38d76580a85ba0266e754fd7f93be0..14e16e7bbab8e8f8c4778c7c472bd445c6123280 100644 (file)
@@ -548,6 +548,16 @@ impl<K, Ctx: ScriptContext> Deref for GeneratedKey<K, Ctx> {
     }
 }
 
+impl<K: Clone, Ctx: ScriptContext> Clone for GeneratedKey<K, Ctx> {
+    fn clone(&self) -> GeneratedKey<K, Ctx> {
+        GeneratedKey {
+            key: self.key.clone(),
+            valid_networks: self.valid_networks.clone(),
+            phantom: self.phantom,
+        }
+    }
+}
+
 // Make generated "derivable" keys themselves "derivable". Also make sure they are assigned the
 // right `valid_networks`.
 impl<Ctx, K> DerivableKey<Ctx> for GeneratedKey<K, Ctx>