Implement Display for ShutdownScript
[rust-lightning] / lightning / src / ln / channel.rs
index 78f08ca5366696f5452410b6f731ec67ac09e95a..d5f066c408021c96c1d13e1fa9ae9aaedca9b255 100644 (file)
@@ -608,7 +608,7 @@ impl<Signer: Sign> Channel<Signer> {
 
                if let Some(shutdown_scriptpubkey) = &shutdown_scriptpubkey {
                        if !shutdown_scriptpubkey.is_compatible(their_features) {
-                               return Err(APIError::APIMisuseError { err: format!("Provided a scriptpubkey format not accepted by peer. script: ({})", shutdown_scriptpubkey.clone().into_inner().to_bytes().to_hex()) });
+                               return Err(APIError::APIMisuseError { err: format!("Provided a scriptpubkey format not accepted by peer: {}", shutdown_scriptpubkey) });
                        }
                }
 
@@ -843,7 +843,7 @@ impl<Signer: Sign> Channel<Signer> {
                                        } else {
                                                match ShutdownScript::try_from((script.clone(), their_features)) {
                                                        Ok(shutdown_script) => Some(shutdown_script.into_inner()),
-                                                       Err(_) => return Err(ChannelError::Close(format!("Peer is signaling upfront_shutdown but has provided an unacceptable scriptpubkey format. script: ({})", script.to_bytes().to_hex()))),
+                                                       Err(_) => return Err(ChannelError::Close(format!("Peer is signaling upfront_shutdown but has provided an unacceptable scriptpubkey format: {}", script))),
                                                }
                                        }
                                },
@@ -860,7 +860,7 @@ impl<Signer: Sign> Channel<Signer> {
 
                if let Some(shutdown_scriptpubkey) = &shutdown_scriptpubkey {
                        if !shutdown_scriptpubkey.is_compatible(&their_features) {
-                               return Err(ChannelError::Close(format!("Provided a scriptpubkey format not accepted by peer. script: ({})", shutdown_scriptpubkey.clone().into_inner().to_bytes().to_hex())));
+                               return Err(ChannelError::Close(format!("Provided a scriptpubkey format not accepted by peer: {}", shutdown_scriptpubkey)));
                        }
                }
 
@@ -1587,7 +1587,7 @@ impl<Signer: Sign> Channel<Signer> {
                                        } else {
                                                match ShutdownScript::try_from((script.clone(), their_features)) {
                                                        Ok(shutdown_script) => Some(shutdown_script.into_inner()),
-                                                       Err(_) => return Err(ChannelError::Close(format!("Peer is signaling upfront_shutdown but has provided an unacceptable scriptpubkey format. script: ({})", script.to_bytes().to_hex()))),
+                                                       Err(_) => return Err(ChannelError::Close(format!("Peer is signaling upfront_shutdown but has provided an unacceptable scriptpubkey format: {}", script))),
                                                }
                                        }
                                },
@@ -3295,7 +3295,7 @@ impl<Signer: Sign> Channel<Signer> {
                                assert!(send_shutdown);
                                let shutdown_scriptpubkey = keys_provider.get_shutdown_scriptpubkey();
                                if !shutdown_scriptpubkey.is_compatible(their_features) {
-                                       return Err(ChannelError::Close(format!("Provided a scriptpubkey format not accepted by peer. script: ({})", shutdown_scriptpubkey.clone().into_inner().to_bytes().to_hex())));
+                                       return Err(ChannelError::Close(format!("Provided a scriptpubkey format not accepted by peer: {}", shutdown_scriptpubkey)));
                                }
                                self.shutdown_scriptpubkey = Some(shutdown_scriptpubkey);
                                true
@@ -4487,7 +4487,7 @@ impl<Signer: Sign> Channel<Signer> {
                        None => {
                                let shutdown_scriptpubkey = keys_provider.get_shutdown_scriptpubkey();
                                if !shutdown_scriptpubkey.is_compatible(their_features) {
-                                       return Err(APIError::APIMisuseError { err: format!("Provided a scriptpubkey format not accepted by peer. script: ({})", shutdown_scriptpubkey.clone().into_inner().to_bytes().to_hex()) });
+                                       return Err(APIError::APIMisuseError { err: format!("Provided a scriptpubkey format not accepted by peer: {}", shutdown_scriptpubkey) });
                                }
                                self.shutdown_scriptpubkey = Some(shutdown_scriptpubkey);
                                true