mirror of
https://github.com/creating2morrow/neveko.git
synced 2024-12-22 19:49:24 +00:00
fix expiration overwrite on prove payment retry
This commit is contained in:
parent
39827212f6
commit
185e91ccf8
1 changed files with 6 additions and 17 deletions
|
@ -6,7 +6,6 @@ use std::sync::mpsc::{
|
|||
|
||||
use crate::{
|
||||
ADD_CONTACT_TIMEOUT_SECS,
|
||||
BLOCK_TIME_IN_SECS_EST,
|
||||
};
|
||||
|
||||
// TODO(c2m): better error handling with and error_tx/error_rx channel
|
||||
|
@ -358,7 +357,8 @@ impl eframe::App for AddressBookApp {
|
|||
}
|
||||
if self.status.txp != utils::empty_string()
|
||||
&& self.status.jwp == utils::empty_string()
|
||||
&& status == "online" {
|
||||
&& status == "online"
|
||||
{
|
||||
if ui.button("Prove Retry").clicked() {
|
||||
send_payment_req(
|
||||
self.payment_tx.clone(),
|
||||
|
@ -685,8 +685,8 @@ fn send_payment_req(
|
|||
let ftxp_address = String::from(&d.address);
|
||||
log::debug!("sending {} piconero(s) to: {}", &d.amount, &d.address);
|
||||
let wallet_name = String::from(neveko_core::APP_NAME);
|
||||
let wallet_password =
|
||||
std::env::var(neveko_core::MONERO_WALLET_PASSWORD).unwrap_or(String::from("password"));
|
||||
let wallet_password = std::env::var(neveko_core::MONERO_WALLET_PASSWORD)
|
||||
.unwrap_or(String::from("password"));
|
||||
monero::open_wallet(&wallet_name, &wallet_password).await;
|
||||
let transfer: reqres::XmrRpcTransferResponse = monero::transfer(d).await;
|
||||
// in order to keep the jwp creation process transparent to the user
|
||||
|
@ -704,6 +704,7 @@ fn send_payment_req(
|
|||
};
|
||||
log::debug!("creating transaction proof for: {}", &ptxp.hash);
|
||||
let get_txp: reqres::XmrRpcGetTxProofResponse = monero::get_tx_proof(ptxp).await;
|
||||
// TODO(c2m): error handling on failed tx proof generation
|
||||
// use the signature to create the FINALIZED transaction proof
|
||||
let ftxp: proof::TxProof = proof::TxProof {
|
||||
subaddress: ftxp_address,
|
||||
|
@ -746,9 +747,7 @@ fn send_payment_req(
|
|||
);
|
||||
// this is just an estimate expiration but should suffice
|
||||
let seconds: i64 = expire as i64 * 2 * 60;
|
||||
// subtract 120 seconds since we had to wait for one confirmation
|
||||
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() + seconds;
|
||||
utils::write_gui_db(
|
||||
String::from("gui-exp"),
|
||||
String::from(&contact),
|
||||
|
@ -794,16 +793,6 @@ fn send_payment_req(
|
|||
String::from(&contact),
|
||||
String::from(&result.jwp),
|
||||
);
|
||||
// this is just an estimate expiration but should suffice
|
||||
let seconds: i64 = expire as i64 * 2 * 60;
|
||||
// subtract 120 seconds since we had to wait for one confirmation
|
||||
let grace: i64 = seconds - BLOCK_TIME_IN_SECS_EST as i64;
|
||||
let unix: i64 = chrono::offset::Utc::now().timestamp() + grace;
|
||||
utils::write_gui_db(
|
||||
String::from("gui-exp"),
|
||||
String::from(&contact),
|
||||
format!("{}", unix),
|
||||
);
|
||||
ctx.request_repaint();
|
||||
}
|
||||
_ => log::error!("failed to obtain jwp"),
|
||||
|
|
Loading…
Reference in a new issue