Skip to content

Commit

Permalink
runtime: Reference the mapping context safely in handle_ethereum_block
Browse files Browse the repository at this point in the history
  • Loading branch information
fordN committed Jul 13, 2020
1 parent 6188412 commit 173ee3e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions runtime/wasm/src/module/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@ impl WasmInstance {
mut self,
handler_name: &str,
) -> Result<BlockState, anyhow::Error> {
let block: &Arc<EthereumBlockType> = &self.take_ctx().ctx.block;
let context = self.take_ctx();

// Prepare an Ethereum Block for the WASM runtime
let arg = match block.as_ref() {
let arg = match context.ctx.block.as_ref() {
EthereumBlockType::FullWithReceipts(block) => self
.asc_new::<AscFullEthereumBlockWithReceipts, _>(
&FullEthereumBlockDataWithReceipts::from(block),
&FullEthereumBlockDataWithReceipts::try_from(block).unwrap(),
)
.erase(),
EthereumBlockType::Full(block) => self
Expand All @@ -180,7 +180,7 @@ impl WasmInstance {

self.invoke_handler(handler_name, arg)?;

Ok(self.take_ctx().ctx.state)
Ok(context.ctx.state)
}

pub(crate) fn take_ctx(&mut self) -> WasmInstanceContext {
Expand Down

0 comments on commit 173ee3e

Please sign in to comment.