Implement Display for ShutdownScript
[rust-lightning] / lightning / src / ln / script.rs
index a123de741f043c3459b5b6acd0d3d47f6bf72ae4..3abb334ce478878d154f98b618df1c6ea6e1affe 100644 (file)
@@ -163,6 +163,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;