Implement Display for ShutdownScript
[rust-lightning] / lightning / src / ln / script.rs
index 4ad0af02b908599c8e95550b354ca1c6bb21ef52..29ee0ad385da8051b4a5ef1b185f8ab76d96afeb 100644 (file)
@@ -157,6 +157,15 @@ impl Into<Script> for ShutdownScript {
        }
 }
 
+impl core::fmt::Display for ShutdownScript{
+       fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
+               match &self.0 {
+                       ShutdownScriptImpl::Legacy(_) => self.clone().into_inner().fmt(f),
+                       ShutdownScriptImpl::Bolt2(script) => script.fmt(f),
+               }
+       }
+}
+
 #[cfg(test)]
 mod shutdown_script_tests {
        use super::ShutdownScript;