File tree Expand file tree Collapse file tree 1 file changed +1
-8
lines changed Expand file tree Collapse file tree 1 file changed +1
-8
lines changed Original file line number Diff line number Diff line change @@ -492,10 +492,6 @@ impl Message {
492492 /// [secure signature](https://twitter.com/pwuille/status/1063582706288586752).
493493 #[ inline]
494494 pub fn from_slice ( data : & [ u8 ] ) -> Result < Message , Error > {
495- if data == [ 0 ; constants:: MESSAGE_SIZE ] {
496- return Err ( Error :: InvalidMessage ) ;
497- }
498-
499495 match data. len ( ) {
500496 constants:: MESSAGE_SIZE => {
501497 let mut ret = [ 0 ; constants:: MESSAGE_SIZE ] ;
@@ -1087,10 +1083,7 @@ mod tests {
10871083 Err ( InvalidMessage ) ) ;
10881084 assert_eq ! ( Message :: from_slice( & [ 0 ; constants:: MESSAGE_SIZE + 1 ] ) ,
10891085 Err ( InvalidMessage ) ) ;
1090- assert_eq ! (
1091- Message :: from_slice( & [ 0 ; constants:: MESSAGE_SIZE ] ) ,
1092- Err ( InvalidMessage )
1093- ) ;
1086+ assert ! ( Message :: from_slice( & [ 0 ; constants:: MESSAGE_SIZE ] ) . is_ok( ) ) ;
10941087 assert ! ( Message :: from_slice( & [ 1 ; constants:: MESSAGE_SIZE ] ) . is_ok( ) ) ;
10951088 }
10961089
You can’t perform that action at this time.
0 commit comments