Add option to skip Tor send attempts in TorConfig (#453)

This commit is contained in:
Yeastplume
2020-06-24 10:50:40 +01:00
committed by GitHub
parent bf3f0a49e0
commit 99c2505bf5
6 changed files with 76 additions and 3 deletions
+27
View File
@@ -257,6 +257,7 @@ pub struct SendArgs {
pub target_slate_version: Option<u16>,
pub payment_proof_address: Option<SlatepackAddress>,
pub ttl_blocks: Option<u64>,
pub skip_tor: bool,
//TODO: Remove HF3
pub output_v4_slate: bool,
}
@@ -450,6 +451,14 @@ where
Ok(())
})?;
let tor_config = match tor_config {
Some(mut c) => {
c.skip_send_attempt = Some(args.skip_tor);
Some(c)
}
None => None,
};
let res =
try_slatepack_sync_workflow(&slate, &args.dest, tor_config, tor_sender, false, test_mode);
@@ -653,6 +662,7 @@ where
pub struct ReceiveArgs {
pub input_file: Option<String>,
pub input_slatepack_message: Option<String>,
pub skip_tor: bool,
}
pub fn receive<L, C, K>(
@@ -680,6 +690,14 @@ where
Some(&m) => Some(m.to_owned()),
};
let tor_config = match tor_config {
Some(mut c) => {
c.skip_send_attempt = Some(args.skip_tor);
Some(c)
}
None => None,
};
controller::foreign_single_use(owner_api.wallet_inst.clone(), km, |api| {
slate = api.receive_tx(&slate, Some(&g_args.account), None)?;
Ok(())
@@ -962,6 +980,7 @@ pub struct ProcessInvoiceArgs {
pub slate: Slate,
pub estimate_selection_strategies: bool,
pub ttl_blocks: Option<u64>,
pub skip_tor: bool,
}
/// Process invoice
@@ -1036,6 +1055,14 @@ where
Ok(())
})?;
let tor_config = match tor_config {
Some(mut c) => {
c.skip_send_attempt = Some(args.skip_tor);
Some(c)
}
None => None,
};
let res = try_slatepack_sync_workflow(&slate, &dest, tor_config, None, true, test_mode);
match res {