update tx propgation wait time for proving payment

This commit is contained in:
creating2morrow 2023-06-12 22:54:13 -04:00
parent 96911d4acd
commit bf7ebaa9c1
3 changed files with 25 additions and 25 deletions

View file

@ -4,9 +4,7 @@ use std::sync::mpsc::{
Sender,
};
use crate::{
ADD_CONTACT_TIMEOUT_SECS,
};
use crate::ADD_CONTACT_TIMEOUT_SECS;
// TODO(c2m): better error handling with and error_tx/error_rx channel
// hook into the error thread and show toast messages as required
@ -738,6 +736,12 @@ fn send_payment_req(
String::from(&contact),
&ftxp.hash
);
// if we made it this far we can now request a JWP from our friend
// wait a bit for the tx to propogate
tokio::time::sleep(std::time::Duration::from_secs(
crate::PROPOGATION_TIME_IN_SECS_EST,
))
.await;
match proof::prove_payment(String::from(&contact), &ftxp).await {
Ok(result) => {
utils::write_gui_db(
@ -760,12 +764,6 @@ fn send_payment_req(
_ => log::error!("failed to obtain jwp"),
}
monero::close_wallet(&wallet_name, &wallet_password).await;
// if we made it this far we can now request a JWP from our friend
// wait a bit for the tx to propogate
tokio::time::sleep(std::time::Duration::from_secs(
crate::BLOCK_TIME_IN_SECS_EST,
))
.await;
}
if retry {
let k_hash = String::from("gui-txp-hash");

View file

@ -261,11 +261,11 @@ impl eframe::App for HomeApp {
ui.text_edit_singleline(&mut self.connections.i2p_zero_dir)
.labelled_by(cm_i2p_dir_label.id);
});
let mut is_mainnet = self.connections.mainnet;
if ui.checkbox(&mut is_mainnet, "mainnet").changed() {
self.connections.mainnet = !self.connections.mainnet;
log::debug!("is mainnet: {}", self.connections.mainnet);
}
// let mut is_mainnet = self.connections.mainnet;
// if ui.checkbox(&mut is_mainnet, "mainnet").changed() {
// self.connections.mainnet = !self.connections.mainnet;
// log::debug!("is mainnet: {}", self.connections.mainnet);
// }
if ui.button("Start/Restart").clicked() {
self.is_editing_connections = false;
utils::kill_child_processes(true);

View file

@ -13,6 +13,8 @@ pub const LOCK_SCREEN_TIMEOUT_SECS: u64 = 60 * 5;
pub const CRED_CHECK_INTERVAL: u64 = 5;
/// monero estimated block time in seconds
pub const BLOCK_TIME_IN_SECS_EST: u64 = 0x78;
/// monero estimated propogation time in seconds
pub const PROPOGATION_TIME_IN_SECS_EST: u64 = 0x1E;
/// time to wait before giving up on adding a contact
pub const ADD_CONTACT_TIMEOUT_SECS: u64 = 0x5A;
/// time to wait before giving up on neveko core