diff --git a/crates/primitives/src/result.rs b/crates/primitives/src/result.rs index 6baa8f25bd..abbcc4f2bf 100644 --- a/crates/primitives/src/result.rs +++ b/crates/primitives/src/result.rs @@ -51,6 +51,14 @@ impl ExecutionResult { } } + /// Consumes the type and returns logs, if execution is not successful, function will return empty vec. + pub fn into_logs(self) -> Vec { + match self { + Self::Success { logs, .. } => logs, + _ => Vec::new(), + } + } + pub fn gas_used(&self) -> u64 { let (Self::Success { gas_used, .. } | Self::Revert { gas_used, .. }