improve wallet controll during multisig orchestration

This commit is contained in:
creating2morrow 2023-11-04 18:22:44 -04:00
parent f22af8c947
commit 56f961e9b3
4 changed files with 12 additions and 8 deletions

View file

@ -26,12 +26,12 @@ NEVidebla-EKOnomia (invisible economy)
* `git clone https://github.com/creating2morrow/neveko`
* `cd neveko && ./scripts/build_all_and_run.sh "-- -h"`
* Example to start neveko with remote stagenet node / i2p proxy remote for development:
* `./scripts/build_all_and_run.sh "-- --monero-location /home/user/monero-x86_64-linux-gnu-v0.18.3.1 --monero-rpc-host http://127.0.0.1:38083 --monero-rpc-daemon http://xmr3kaacphwkk4z2gp35bdl47lrrnzimmyqj4oliauqrjzqecofa.b32.i2p:38081 --monero-rpc-username user --monero-rpc-cred pass --remote-node --i2p-advanced --i2p-tunnels-json /home/user/neveko/i2p-manual/config --i2p-proxy-host http://x.x.x.x:xxxx --i2p-socks-proxy-host http://x.x.x.x:xxxx"`
* `./scripts/build_all_and_run.sh "-- --monero-location monero-x86_64-linux-gnu-v0.18.3.1 --monero-rpc-host http://127.0.0.1:38083 --monero-rpc-daemon http://xmr3kaacphwkk4z2gp35bdl47lrrnzimmyqj4oliauqrjzqecofa.b32.i2p:38081 --monero-rpc-username user --monero-rpc-cred pass --remote-node --i2p-advanced --i2p-tunnels-json /home/user/neveko/i2p-manual/config --i2p-proxy-host http://x.x.x.x:xxxx --i2p-socks-proxy-host http://x.x.x.x:xxxx"`
* the `--monero-location` flag is needed even when using a remote node because
neveko has its own monero-wallet-rpc instance
* remote nodes are forced over the `--i2p-proxy-host`
* Recommended neveko-core startup with full node and i2p-zero locally running:
* ` ./scripts/build_all_and_run.sh "-- --monero-blockchain-dir=/home/user/.bitmonero --monero-location /home/user/monero-x86_64-linux-gnu-v0.18.3.1 --i2p-zero-dir /home/user/i2p-zero-linux.v1.21/ --monero-blockchain-dir /home/user/.bitmonero"`
* ` ./scripts/build_all_and_run.sh "-- --monero-blockchain-dir=/home/user/.bitmonero --monero-location monero-x86_64-linux-gnu-v0.18.3.1 --i2p-zero-dir /home/user/i2p-zero-linux.v1.21/ --monero-blockchain-dir /home/user/.bitmonero"`
* monerod doesn't need to be running because neveko will start it and monero-wallet-rpc
* gui will automatically detect monerod, rpc and i2p-zero if neveko core is started first
* Neveko doesn't write logs to file. Use the command below to write to a log file:

View file

@ -311,7 +311,8 @@ fn get_blockchain_dir() -> String {
/// Get monero download location
fn get_monero_location() -> String {
let args = args::Args::parse();
String::from(args.monero_location)
let user = std::env::var("USER").unwrap_or(utils::empty_string());
format!("/home/{}/{}", &user, &args.monero_location)
}
/// Get monero rpc host from the `--monero-rpc-host` cli arg
@ -1407,7 +1408,7 @@ pub fn enable_experimental_multisig(wallet_file: &String) {
"set", "enable-multisig-experimental", "1"
]
};
let mut output = Command::new(format!("/home/{}/{}/monero-wallet-cli", &user, bin_dir))
let mut output = Command::new(format!("{}/monero-wallet-cli", bin_dir))
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.args(args)

View file

@ -49,6 +49,7 @@ pub async fn create(j_order: Json<reqres::OrderRequest>) -> Order {
let ts = chrono::offset::Utc::now().timestamp();
let orid: String = format!("{}{}", crate::ORDER_DB_KEY, utils::generate_rnd());
let r_subaddress = monero::create_address().await;
monero::close_wallet(&wallet_name, &wallet_password).await;
let subaddress = r_subaddress.result.address;
let new_order = Order {
orid: String::from(&orid),
@ -62,14 +63,15 @@ pub async fn create(j_order: Json<reqres::OrderRequest>) -> Order {
..Default::default()
};
debug!("insert order: {:?}", new_order);
let m_wallet = monero::create_wallet(&orid, &utils::empty_string()).await;
let order_wallet_password = utils::empty_string();
let m_wallet = monero::create_wallet(&orid, &order_wallet_password).await;
if !m_wallet {
error!("error creating msig wallet for order {}", &orid);
monero::close_wallet(&orid, &wallet_password).await;
return Default::default();
}
// enable multisig
monero::close_wallet(&orid, &wallet_password).await;
monero::close_wallet(&orid, &order_wallet_password).await;
monero::enable_experimental_multisig(&orid);
debug!("insert order: {:?}", &new_order);
let s = db::Interface::open();

View file

@ -426,7 +426,7 @@ impl eframe::App for MarketApp {
}
if self.msig.completed_make && !self.msig.completed_kex_init {
ui.horizontal(|ui| {
ui.label("Kex Exchange Initial: \t\t\t");
ui.label("Key Exchange Initial: \t\t\t");
if ui.button("KEX-INIT").clicked() {
self.is_loading = true;
let mediator_prefix = String::from(crate::GUI_MSIG_MEDIATOR_DB_KEY);
@ -461,7 +461,7 @@ impl eframe::App for MarketApp {
}
if self.msig.completed_kex_init && !self.msig.completed_kex_final {
ui.horizontal(|ui| {
ui.label("Kex Exchange Final: \t\t\t");
ui.label("Key Exchange Final: \t\t\t");
if ui.button("KEX-FINAL").clicked() {
self.is_loading = true;
let mediator_prefix = String::from(crate::GUI_MSIG_MEDIATOR_DB_KEY);
@ -1414,6 +1414,7 @@ fn send_prepare_info_req(
let m_wallet = monero::open_wallet(&w_orid, &wallet_password).await;
if !m_wallet {
log::error!("failed to open wallet");
monero::close_wallet(&w_orid, &wallet_password).await;
let _ = tx.send(utils::empty_string());
return;
}