Skip to content

Commit

Permalink
better fix for error
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Apr 19, 2024
1 parent b2e3b10 commit 5ac4593
Showing 1 changed file with 25 additions and 28 deletions.
53 changes: 25 additions & 28 deletions mantis/node/src/mantis/blackbox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,37 +191,34 @@ pub async fn solve<Decider: Get<bool>>(

for pair_solution in cows_per_pair {
let salt = super::cosmos::cvm::calculate_salt(signing_key, tip, pair_solution.ab.clone());
let cvm_program = if let Some(ref cvm_glt) = cvm_glt {
let cvm_program = intent_banks_to_cvm_program(
pair_solution.clone(),
&active_orders,
cvm_glt,
router,
&salt,
)
.await;

if cvm_program.is_err() {
log::error!("cvm_program error: {:?}", cvm_program);
continue;
}

let cvm_program = cvm_program.expect("qed");
// would be reasonable to do do cross chain if it solves some % of whole trade
let route = if Decider::get() {
let cvm_program = if let Some(ref cvm_glt) = cvm_glt {
let cvm_program = intent_banks_to_cvm_program(
pair_solution.clone(),
&active_orders,
cvm_glt,
router,
&salt,
)
.await;

Some(cvm_program)
} else {
None
};
if cvm_program.is_err() {
log::error!("cvm_program error: {:?}", cvm_program);
}
cvm_program.ok()
} else {
None
};

// would be reasonable to do do cross chain if it solves some % of whole trade
let route = if let Some(cvm_program) = cvm_program
&& Decider::get()
{
Some(CrossChainPart::new(
cvm_program,
salt.clone(),
pair_solution.optimal_price.into(),
))
cvm_program.map(|cvm_program| {
CrossChainPart::new(
cvm_program,
salt.clone(),
pair_solution.optimal_price.into(),
)
})
} else {
None
};
Expand Down

0 comments on commit 5ac4593

Please sign in to comment.