remove duplicate constants

This commit is contained in:
creating2morrow 2023-05-04 03:08:23 -04:00
parent de96f8fc4c
commit 5480823400
2 changed files with 4 additions and 7 deletions

View file

@ -1,7 +1,7 @@
use nevmes_core::*; use nevmes_core::*;
use std::sync::mpsc::{Receiver, Sender}; use std::sync::mpsc::{Receiver, Sender};
use crate::{ADD_CONTACT_TIMEOUT_SECS, BLOCK_TIME_IN_SECS_EST_I64, BLOCK_TIME_IN_SECS_EST_U64}; use crate::{ADD_CONTACT_TIMEOUT_SECS, BLOCK_TIME_IN_SECS_EST};
// TODO(c2m): better error handling with and error_tx/error_rx channel // TODO(c2m): better error handling with and error_tx/error_rx channel
// hook into the error thread and show toast messages as required // hook into the error thread and show toast messages as required
@ -20,6 +20,7 @@ impl Default for Compose {
} }
} }
} }
/// Struct for the contact status window /// Struct for the contact status window
struct Status { struct Status {
/// UNIX timestamp of expiration as string /// UNIX timestamp of expiration as string
@ -678,7 +679,7 @@ fn send_payment_req(
if check_txp.result.good && check_txp.result.confirmations > 0 { if check_txp.result.good && check_txp.result.confirmations > 0 {
break; break;
} }
tokio::time::sleep(std::time::Duration::from_secs(BLOCK_TIME_IN_SECS_EST_U64)).await; tokio::time::sleep(std::time::Duration::from_secs(BLOCK_TIME_IN_SECS_EST as u64)).await;
retry_count += 1; retry_count += 1;
} }
write_gui_db( write_gui_db(
@ -702,7 +703,7 @@ fn send_payment_req(
// this is just an estimate expiration but should suffice // this is just an estimate expiration but should suffice
let seconds: i64 = expire as i64 * 2 * 60; let seconds: i64 = expire as i64 * 2 * 60;
// subtract 120 seconds since we had to wait for one confirmation // subtract 120 seconds since we had to wait for one confirmation
let grace: i64 = seconds - BLOCK_TIME_IN_SECS_EST_I64; let grace: i64 = seconds - BLOCK_TIME_IN_SECS_EST as i64;
let unix: i64 = chrono::offset::Utc::now().timestamp() + grace; let unix: i64 = chrono::offset::Utc::now().timestamp() + grace;
write_gui_db( write_gui_db(
String::from("gui-exp"), String::from("gui-exp"),

View file

@ -15,10 +15,6 @@ pub const LOCK_SCREEN_TIMEOUT_SECS: u64 = 60*5;
pub const CRED_CHECK_INTERVAL: u64 = 5; pub const CRED_CHECK_INTERVAL: u64 = 5;
/// monero estimated block time in seconds /// monero estimated block time in seconds
pub const BLOCK_TIME_IN_SECS_EST: u128 = 0x78; pub const BLOCK_TIME_IN_SECS_EST: u128 = 0x78;
/// monero estimated block time in seconds u64 for awaiting tx proof confirmations
pub const BLOCK_TIME_IN_SECS_EST_U64: u64 = 0x78;
/// monero estimated block time in seconds i64 for calculating client side jwp expiration
pub const BLOCK_TIME_IN_SECS_EST_I64: i64 = 0x78;
/// time to wait before giving up on adding a contact /// time to wait before giving up on adding a contact
pub const ADD_CONTACT_TIMEOUT_SECS: u64 = 0x5A; pub const ADD_CONTACT_TIMEOUT_SECS: u64 = 0x5A;
/// time to wait before giving up on nevmes core /// time to wait before giving up on nevmes core