make sweep_all tx_hash_list optional

This commit is contained in:
creating2morrow 2023-12-06 07:39:44 -05:00
parent 352f2f5abe
commit 588e45d2bf
2 changed files with 5 additions and 5 deletions

View file

@ -340,10 +340,11 @@ pub async fn upload_delivery_info(
// get draft payment txset
let wallet_password = utils::empty_string();
monero::open_wallet(&orid, &wallet_password).await;
let mut sweep: reqres::XmrRpcSweepAllResponse =
monero::refresh().await;
let sweep: reqres::XmrRpcSweepAllResponse =
monero::sweep_all(String::from(&lookup.subaddress)).await;
monero::close_wallet(&orid, &wallet_password).await;
if sweep.result.tx_hash_list.is_empty() {
if sweep.result.multisig_txset.is_empty() {
error!("unable to create draft txset");
return Default::default();
}
@ -351,7 +352,6 @@ pub async fn upload_delivery_info(
let mut m_order: Order = find(orid);
m_order.status = StatusType::Shipped.value();
m_order.ship_date = chrono::offset::Utc::now().timestamp();
m_order.hash = String::from(&sweep.result.tx_hash_list.remove(0));
m_order.vend_msig_txset = sweep.result.multisig_txset;
// delivery info will be stored encrypted and separate from the rest of the
// order

View file

@ -526,7 +526,7 @@ pub struct XmrRpcSweepAllResult {
pub fee_list: Vec<u128>,
pub multisig_txset: String,
pub spent_key_images_list: Vec<KeyImageList>,
pub tx_hash_list: Vec<String>,
pub tx_hash_list: Option<Vec<String>>,
pub unsigned_txset: String,
pub weight_list: Vec<u128>,
}
@ -1097,7 +1097,7 @@ impl Default for XmrRpcSweepAllResponse {
fee_list: Vec::new(),
multisig_txset: utils::empty_string(),
spent_key_images_list: Vec::new(),
tx_hash_list: Vec::new(),
tx_hash_list: Some(Vec::new()),
unsigned_txset: utils::empty_string(),
weight_list: Vec::new(),
},