diff --git a/mantis/node/src/bin/mantis.rs b/mantis/node/src/bin/mantis.rs index a468b86..6a48534 100644 --- a/mantis/node/src/bin/mantis.rs +++ b/mantis/node/src/bin/mantis.rs @@ -76,19 +76,11 @@ async fn solve_orders(solver_args: &SolverArgs) { chain_id: args.main_chain_id.clone(), }; loop { - let tip = + let mut tip = get_latest_block_and_account_by_key(&args.rpc_centauri, &args.grpc_centauri, &signer) .await; - let stale_orders = mantis_node::mantis::indexer::get_stale_orders( - &args.order_contract, - &mut wasm_read_client, - &tip, - ) - .await; - if stale_orders.len() > 0 || rand::random::() > 200 { - if stale_orders.len() > 0 { - log::warn!(target: "mantis::autopilot", "timedouted orders"); - } + + if rand::random::() > 150 { autopilot::cleanup( &mut write_client, &mut cosmos_query_client, @@ -99,6 +91,30 @@ async fn solve_orders(solver_args: &SolverArgs) { gas, ) .await; + tip.account.sequence += 1; + } else { + let stale_orders = mantis_node::mantis::indexer::get_stale_orders( + &args.order_contract, + &mut wasm_read_client, + &tip, + ) + .await; + if stale_orders.len() > 0 { + if stale_orders.len() > 0 { + log::warn!(target: "mantis::autopilot", "timedouted orders"); + } + autopilot::cleanup( + &mut write_client, + &mut cosmos_query_client, + args.order_contract.clone(), + &signer, + &cosmos_chain_info, + &tip, + gas, + ) + .await; + tip.account.sequence += 1; + } } let mut tip = diff --git a/mantis/node/src/mantis/cosmos/cosmwasm.rs b/mantis/node/src/mantis/cosmos/cosmwasm.rs index 3213fa9..b1f9f76 100644 --- a/mantis/node/src/mantis/cosmos/cosmwasm.rs +++ b/mantis/node/src/mantis/cosmos/cosmwasm.rs @@ -52,7 +52,7 @@ pub async fn smart_query