Fixing panic messages for decryption procedures
authorDr. Maxim Orlovsky <orlovsky@pandoracore.com>
Tue, 21 Jul 2020 11:39:39 +0000 (13:39 +0200)
committerDr Maxim Orlovsky <dr.orlovsky@gmail.com>
Tue, 21 Jul 2020 16:10:58 +0000 (18:10 +0200)
lightning/src/ln/peer_channel_encryptor.rs

index 6965aac560519c4182accdea8485663d939eb477..9f6797591b1dacea08d91b4549d9812d5a353692 100644 (file)
@@ -421,7 +421,7 @@ impl PeerChannelEncryptor {
                                *rn += 1;
                                Ok(byte_utils::slice_to_be16(&res))
                        },
-                       _ => panic!("Tried to encrypt a message prior to noise handshake completion"),
+                       _ => panic!("Tried to decrypt a message prior to noise handshake completion"),
                }
        }
 
@@ -429,7 +429,7 @@ impl PeerChannelEncryptor {
        /// panics if msg.len() > 65535 + 16
        pub fn decrypt_message(&mut self, msg: &[u8]) -> Result<Vec<u8>, LightningError> {
                if msg.len() > LN_MAX_MSG_LEN + 16 {
-                       panic!("Attempted to encrypt message longer than 65535 bytes!");
+                       panic!("Attempted to decrypt message longer than 65535 + 16 bytes!");
                }
 
                match self.noise_state {
@@ -441,7 +441,7 @@ impl PeerChannelEncryptor {
 
                                Ok(res)
                        },
-                       _ => panic!("Tried to encrypt a message prior to noise handshake completion"),
+                       _ => panic!("Tried to decrypt a message prior to noise handshake completion"),
                }
        }