Skip to content

Commit

Permalink
evm_discard_context removes the context queue
Browse files Browse the repository at this point in the history
  • Loading branch information
Jouzo committed Jun 9, 2023
1 parent 94b2380 commit 96e3f5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
4 changes: 4 additions & 0 deletions lib/ain-evm/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ impl EVMHandler {
self.tx_queues.clear(context)?;
Ok(())
}

pub fn remove(&self, context: u64) {
self.tx_queues.remove(context);
}
}

impl EVMHandler {
Expand Down
14 changes: 3 additions & 11 deletions lib/ain-rs-exports/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub mod ffi {
fn evm_try_prevalidate_raw_tx(result: &mut RustRes, tx: &str) -> Result<ValidateTxResult>;

fn evm_get_context() -> u64;
fn evm_discard_context(context: u64) -> Result<()>;
fn evm_discard_context(context: u64);
fn evm_try_queue_tx(
result: &mut RustRes,
context: u64,
Expand Down Expand Up @@ -340,16 +340,8 @@ pub fn evm_get_context() -> u64 {
///
/// * `context` - The context queue number.
///
/// # Errors
///
/// Returns an Error if the context does not match any existing queue.
/// # Returns
///
/// Returns `Ok(())` on success.
fn evm_discard_context(context: u64) -> Result<(), Box<dyn Error>> {
// TODO discard
RUNTIME.handlers.evm.clear(context)?;
Ok(())
fn evm_discard_context(context: u64) {
RUNTIME.handlers.evm.remove(context)
}

/// Add an EVM transaction to a specific queue.
Expand Down

0 comments on commit 96e3f5c

Please sign in to comment.