handle panic on failure to create draft txset

This commit is contained in:
creating2morrow 2023-12-05 05:23:05 -05:00
parent 1e65a87127
commit 352f2f5abe

View file

@ -22,7 +22,6 @@ use log::{
info, info,
}; };
use rocket::serde::json::Json; use rocket::serde::json::Json;
use serde::de;
pub enum StatusType { pub enum StatusType {
_Cancelled, _Cancelled,
@ -339,8 +338,15 @@ pub async fn upload_delivery_info(
error!("unable to encrypt delivery info"); error!("unable to encrypt delivery info");
} }
// get draft payment txset // get draft payment txset
let wallet_password = utils::empty_string();
monero::open_wallet(&orid, &wallet_password).await;
let mut sweep: reqres::XmrRpcSweepAllResponse = let mut sweep: reqres::XmrRpcSweepAllResponse =
monero::sweep_all(String::from(&lookup.subaddress)).await; monero::sweep_all(String::from(&lookup.subaddress)).await;
monero::close_wallet(&orid, &wallet_password).await;
if sweep.result.tx_hash_list.is_empty() {
error!("unable to create draft txset");
return Default::default();
}
// update the order // update the order
let mut m_order: Order = find(orid); let mut m_order: Order = find(orid);
m_order.status = StatusType::Shipped.value(); m_order.status = StatusType::Shipped.value();