Skip to content

Commit

Permalink
chore: use option
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Mar 25, 2024
1 parent c1633be commit e03a155
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions crates/rpc/rpc/src/otterscan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,19 @@ where

/// Handler for `ots_getTransactionError`
async fn get_transaction_error(&self, tx_hash: TxHash) -> RpcResult<Option<Bytes>> {
self.eth
let maybe_revert = self
.eth
.spawn_trace_transaction_in_block_with_inspector(
tx_hash,
NoOpInspector,
|_tx_info, _inspector, res, _| match res.result {
ExecutionResult::Revert { output, .. } => Ok(output),
_ => Ok(Bytes::new()),
ExecutionResult::Revert { output, .. } => Ok(Some(output)),
_ => Ok(None),
},
)
.await
.map_err(|e| internal_rpc_err(e.to_string()))
.map(Option::flatten)?;
Ok(maybe_revert)
}

/// Handler for `ots_traceTransaction`
Expand Down

0 comments on commit e03a155

Please sign in to comment.