From a94718ed757677dfd02ceffb4a213772ae489f83 Mon Sep 17 00:00:00 2001 From: creating2morrow Date: Sat, 7 Oct 2023 06:57:10 -0400 Subject: [PATCH] enable experimental multisig on wallet creation --- neveko-core/src/monero.rs | 17 +++++++++++++++++ neveko-core/src/order.rs | 4 ++++ neveko-core/src/utils.rs | 1 + neveko-gui/src/apps/market.rs | 2 ++ scripts/build_debug_release.sh | 2 +- scripts/build_release.sh | 2 +- 6 files changed, 26 insertions(+), 2 deletions(-) diff --git a/neveko-core/src/monero.rs b/neveko-core/src/monero.rs index 7218e56..0526330 100644 --- a/neveko-core/src/monero.rs +++ b/neveko-core/src/monero.rs @@ -1383,3 +1383,20 @@ pub async fn p_get_transactions( Err(_) => Ok(Default::default()), } } + +/// enable multisig - `monero-wallet-cli --password <> --wallet-file <> set enable-multisig-experimental 1` +pub fn enable_experimental_multisig(wallet_file: &String) { + let bin_dir = get_monero_location(); + let wallet_password = + std::env::var(crate::MONERO_WALLET_PASSWORD).unwrap_or(String::from("password")); + let args = vec![ + "--password", &wallet_password, + "--wallet-file", &wallet_file, + "set", "enable-mulitsig-experimental", "1" + ]; + let output = Command::new(format!("{}/monero-wallet-cli", bin_dir)) + .args(args) + .spawn() + .expect("failed to enable experimental msig"); + debug!("{:?}", output.stdout); +} diff --git a/neveko-core/src/order.rs b/neveko-core/src/order.rs index 70e0a0f..fe2f951 100644 --- a/neveko-core/src/order.rs +++ b/neveko-core/src/order.rs @@ -68,6 +68,8 @@ pub async fn create(j_order: Json) -> Order { monero::close_wallet(&orid, &wallet_password).await; return Default::default(); } + // enable multisig + monero::enable_experimental_multisig(&orid); debug!("insert order: {:?}", &new_order); let s = db::Interface::open(); let k = &new_order.orid; @@ -373,4 +375,6 @@ pub async fn init_mediator_wallet(orid: &String) { if !m_wallet { log::error!("failed to create mediator wallet"); } + // enable multisig + monero::enable_experimental_multisig(&orid); } diff --git a/neveko-core/src/utils.rs b/neveko-core/src/utils.rs index 22186cd..30b9727 100644 --- a/neveko-core/src/utils.rs +++ b/neveko-core/src/utils.rs @@ -528,6 +528,7 @@ fn start_gui() { /// Put all app pre-checks here pub async fn start_up() { info!("neveko is starting up"); + warn!("monero multising is experimental and usage of neveko may lead to loss of funds"); let args = args::Args::parse(); if args.remote_access { start_micro_servers(); diff --git a/neveko-gui/src/apps/market.rs b/neveko-gui/src/apps/market.rs index eae39c3..fc85897 100644 --- a/neveko-gui/src/apps/market.rs +++ b/neveko-gui/src/apps/market.rs @@ -1418,6 +1418,8 @@ fn send_prepare_info_req( let _ = tx.send(utils::empty_string()); return; } + // enable multisig + monero::enable_experimental_multisig(&w_orid); let prepare_info = monero::prepare_wallet().await; monero::close_wallet(&w_orid, &wallet_password).await; let ref_prepare_info: &String = &prepare_info.result.multisig_info; diff --git a/scripts/build_debug_release.sh b/scripts/build_debug_release.sh index c8048c3..79bf232 100755 --- a/scripts/build_debug_release.sh +++ b/scripts/build_debug_release.sh @@ -45,4 +45,4 @@ cd ../ cd $MESSAGE_PATH && cargo build && cp $DEBUG_DIR/$MESSAGE_BINARY ../$MESSAGE_DIR cd ../ # make the bzip for linux -cd .build/debug/ && tar -cjf $RELEASE_NAME.tar.bz2 $RELEASE_NAME/ && mv $RELEASE_NAME.tar.bz2 ../../ \ No newline at end of file +cd .build/debug/ && tar -cjf $RELEASE_NAME.tar.bz2 $RELEASE_NAME/ && mv $RELEASE_NAME.tar.bz2 ../../ diff --git a/scripts/build_release.sh b/scripts/build_release.sh index 7eaadb5..f9226a4 100755 --- a/scripts/build_release.sh +++ b/scripts/build_release.sh @@ -24,4 +24,4 @@ cd ../ cd neveko-message && cargo build --release && cp target/release/neveko_message ../$LINUX_OUTPUT_DIR cd ../ # make the bzip for linux -cd .build/release/ && tar -cjf $RELEASE_NAME.tar.bz2 $RELEASE_NAME/ && mv $RELEASE_NAME.tar.bz2 ../../ \ No newline at end of file +cd .build/release/ && tar -cjf $RELEASE_NAME.tar.bz2 $RELEASE_NAME/ && mv $RELEASE_NAME.tar.bz2 ../../