From a7b50d772aba468189e4dcdf9714bfa2a26c6dc5 Mon Sep 17 00:00:00 2001 From: Vitor Enes Date: Fri, 5 Feb 2021 10:23:39 +0100 Subject: [PATCH] Fix panic in conn open try when no connection id is provided --- modules/src/ics03_connection/context.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/src/ics03_connection/context.rs b/modules/src/ics03_connection/context.rs index a0b9bc6140..718101a842 100644 --- a/modules/src/ics03_connection/context.rs +++ b/modules/src/ics03_connection/context.rs @@ -72,14 +72,14 @@ pub trait ConnectionKeeper { )?; } State::TryOpen => { - self.store_connection( - &result.connection_id.clone().unwrap(), - &result.connection_end, - )?; + let connection_id = result + .connection_id + .unwrap_or_else(|| self.next_connection_id()); + self.store_connection(&connection_id, &result.connection_end)?; // If this is the first time the handler processed this connection, associate the // connection end to its client identifier. self.store_connection_to_client( - &result.connection_id.clone().unwrap(), + &connection_id, &result.connection_end.client_id(), )?; }