Skip to content

V5.3.4 mining exchanges #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
741 changes: 434 additions & 307 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mwc_wallet"
version = "5.3.4"
version = "5.3.5"
authors = ["Mwc Developers <[email protected]>"]
description = "Simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format."
license = "Apache-2.0"
Expand Down Expand Up @@ -36,12 +36,12 @@ funty = "=1.1.0"
uuid = { version = "0.8", features = ["serde", "v4"] }
shlex = "1.3.0"

mwc_wallet_api = { path = "./api", version = "5.3.4" }
mwc_wallet_impls = { path = "./impls", version = "5.3.4" }
mwc_wallet_libwallet = { path = "./libwallet", version = "5.3.4" }
mwc_wallet_controller = { path = "./controller", version = "5.3.4" }
mwc_wallet_config = { path = "./config", version = "5.3.4" }
mwc_wallet_util = { path = "./util", version = "5.3.4" }
mwc_wallet_api = { path = "./api", version = "5.3.5" }
mwc_wallet_impls = { path = "./impls", version = "5.3.5" }
mwc_wallet_libwallet = { path = "./libwallet", version = "5.3.5" }
mwc_wallet_controller = { path = "./controller", version = "5.3.5" }
mwc_wallet_config = { path = "./config", version = "5.3.5" }
mwc_wallet_util = { path = "./util", version = "5.3.5" }

[build-dependencies]
built = { version = "0.4", features = ["git2"]}
Expand All @@ -52,7 +52,7 @@ serde = "1"
serde_derive = "1"
serde_json = "1"
remove_dir_all = "0.7"
easy-jsonrpc-mw = "0.5.4"
easy-jsonrpc-mwc = { git = "https://github.com/mwcproject/easy-jsonrpc-mwc", version = "0.5.5", branch = "master" }

[patch.crates-io]
mwc_secp256k1zkp = { git = "https://github.com/mwcproject/rust-secp256k1-zkp", tag = "0.7.16" }
12 changes: 6 additions & 6 deletions api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mwc_wallet_api"
version = "5.3.4"
version = "5.3.5"
authors = ["Mwc Developers <[email protected]>"]
description = "Mwc Wallet API"
license = "Apache-2.0"
Expand All @@ -16,18 +16,18 @@ serde = "1"
rand = "0.6"
serde_derive = "1"
serde_json = "1"
easy-jsonrpc-mw = "0.5.4"
chrono = { version = "0.4.11", features = ["serde"] }
ring = "0.16"
base64 = "0.12"
ed25519-dalek = "1.0.0-pre.4"
colored = "1.6"
x25519-dalek = "0.6"
easy-jsonrpc-mwc = { git = "https://github.com/mwcproject/easy-jsonrpc-mwc", version = "0.5.5", branch = "master" }

mwc_wallet_libwallet = { path = "../libwallet", version = "5.3.4" }
mwc_wallet_config = { path = "../config", version = "5.3.4" }
mwc_wallet_impls = { path = "../impls", version = "5.3.4" }
mwc_wallet_util = { path = "../util", version = "5.3.4" }
mwc_wallet_libwallet = { path = "../libwallet", version = "5.3.5" }
mwc_wallet_config = { path = "../config", version = "5.3.5" }
mwc_wallet_impls = { path = "../impls", version = "5.3.5" }
mwc_wallet_util = { path = "../util", version = "5.3.5" }

[dev-dependencies]
serde_json = "1"
Expand Down
28 changes: 12 additions & 16 deletions api/src/foreign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use crate::libwallet::{
use crate::util::secp::key::SecretKey;
use crate::util::Mutex;
use ed25519_dalek::PublicKey as DalekPublicKey;
use libwallet::wallet_lock;
use std::sync::Arc;

/// ForeignAPI Middleware Check callback
Expand Down Expand Up @@ -218,9 +219,7 @@ where
/// ```

pub fn get_proof_address(&self) -> Result<String, Error> {
let mut w_lock = self.wallet_inst.lock();
let w = w_lock.lc_provider()?.wallet_inst()?;

wallet_lock!(self.wallet_inst, w);
foreign::get_proof_address(&mut **w, (&self.keychain_mask).as_ref())
}

Expand Down Expand Up @@ -275,8 +274,7 @@ where
/// ```

pub fn build_coinbase(&self, block_fees: &BlockFees) -> Result<CbData, Error> {
let mut w_lock = self.wallet_inst.lock();
let w = w_lock.lc_provider()?.wallet_inst()?;
wallet_lock!(self.wallet_inst, w);
if let Some(m) = self.middleware.as_ref() {
m(
ForeignCheckMiddlewareFn::BuildCoinbase,
Expand Down Expand Up @@ -332,11 +330,13 @@ where

pub fn verify_slate_messages(&self, slate: &Slate) -> Result<(), Error> {
if let Some(m) = self.middleware.as_ref() {
let mut w_lock = self.wallet_inst.lock();
let w = w_lock.lc_provider()?.wallet_inst()?;
let version_info = {
wallet_lock!(self.wallet_inst, w);
w.w2n_client().get_version_info()
};
m(
ForeignCheckMiddlewareFn::VerifySlateMessages,
w.w2n_client().get_version_info(),
version_info,
Some(slate),
)?;
}
Expand Down Expand Up @@ -406,8 +406,7 @@ where
dest_acct_name: &Option<String>,
message: Option<String>,
) -> Result<Slate, Error> {
let mut w_lock = self.wallet_inst.lock();
let w = w_lock.lc_provider()?.wallet_inst()?;
wallet_lock!(self.wallet_inst, w);
if let Some(m) = self.middleware.as_ref() {
m(
ForeignCheckMiddlewareFn::ReceiveTx,
Expand Down Expand Up @@ -479,8 +478,7 @@ where
/// ```

pub fn finalize_invoice_tx(&self, slate: &Slate) -> Result<Slate, Error> {
let mut w_lock = self.wallet_inst.lock();
let w = w_lock.lc_provider()?.wallet_inst()?;
wallet_lock!(self.wallet_inst, w);
if let Some(m) = self.middleware.as_ref() {
m(
ForeignCheckMiddlewareFn::FinalizeInvoiceTx,
Expand Down Expand Up @@ -520,8 +518,7 @@ where
&self,
encrypted_slate: VersionedSlate,
) -> Result<(Slate, SlatePurpose, Option<DalekPublicKey>), Error> {
let mut w_lock = self.wallet_inst.lock();
let w = w_lock.lc_provider()?.wallet_inst()?;
wallet_lock!(self.wallet_inst, w);
let (slate, content, sender, _receiver) = foreign::decrypt_slate(
&mut **w,
(&self.keychain_mask).as_ref(),
Expand All @@ -541,8 +538,7 @@ where
address_index: Option<u32>,
use_test_rng: bool,
) -> Result<VersionedSlate, Error> {
let mut w_lock = self.wallet_inst.lock();
let w = w_lock.lc_provider()?.wallet_inst()?;
wallet_lock!(self.wallet_inst, w);
let vslate = foreign::encrypt_slate(
&mut **w,
(&self.keychain_mask).as_ref(),
Expand Down
23 changes: 17 additions & 6 deletions api/src/foreign_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@ use crate::libwallet::{
Slate, SlateVersion, VersionInfo, VersionedCoinbase, VersionedSlate, WalletLCProvider,
};
use crate::{Foreign, ForeignCheckMiddlewareFn};
use easy_jsonrpc_mw;
use easy_jsonrpc_mwc;
use ed25519_dalek::PublicKey as DalekPublicKey;
use libwallet::slatepack::SlatePurpose;
use libwallet::wallet_lock_test;
use mwc_wallet_libwallet::proof::proofaddress::{self, ProvableAddress};
use mwc_wallet_util::mwc_core::core::Transaction;
use mwc_wallet_util::mwc_util::secp::Secp256k1;
use std::ops::DerefMut;

/// Public definition used to generate Foreign jsonrpc api.
/// * When running `mwc-wallet listen` with defaults, the V2 api is available at
/// `localhost:3415/v2/foreign`
/// * The endpoint only supports POST operations, with the json-rpc request as the body
#[easy_jsonrpc_mw::rpc]
#[easy_jsonrpc_mwc::rpc]
pub trait ForeignRpc {
/**
Networked version of [Foreign::check_version](struct.Foreign.html#method.check_version).
Expand Down Expand Up @@ -1051,7 +1054,7 @@ pub fn run_doctest_foreign(
init_invoice_tx: bool,
compact_slate: bool,
) -> Result<Option<serde_json::Value>, String> {
use easy_jsonrpc_mw::Handler;
use easy_jsonrpc_mwc::Handler;
use mwc_wallet_impls::test_framework::{self, LocalWalletClient, WalletProxy};
use mwc_wallet_impls::{DefaultLCProvider, DefaultWalletImpl};
use mwc_wallet_libwallet::{api_impl, WalletInst};
Expand All @@ -1071,11 +1074,12 @@ pub fn run_doctest_foreign(
let _ = fs::remove_dir_all(test_dir);
global::set_local_chain_type(ChainTypes::AutomatedTesting);

let tx_pool: Arc<Mutex<Vec<Transaction>>> = Arc::new(Mutex::new(Vec::new()));
let mut wallet_proxy: WalletProxy<
DefaultLCProvider<LocalWalletClient, ExtKeychain>,
LocalWalletClient,
ExtKeychain,
> = WalletProxy::new(test_dir);
> = WalletProxy::new(test_dir.into(), tx_pool.clone());
let chain = wallet_proxy.chain.clone();

let rec_phrase_1 = util::ZeroingString::from(
Expand Down Expand Up @@ -1175,6 +1179,7 @@ pub fn run_doctest_foreign(
(&mask1).as_ref(),
1 as usize,
false,
tx_pool.lock().deref_mut(),
);
//update local outputs after each block, so transaction IDs stay consistent
let (wallet_refreshed, _) = api_impl::owner::retrieve_summary_info(
Expand Down Expand Up @@ -1227,7 +1232,10 @@ pub fn run_doctest_foreign(

api_impl::owner::issue_invoice_tx(&mut **w, (&mask2).as_ref(), &args, true, 1).unwrap()
};
api_impl::owner::update_wallet_state(wallet1.clone(), (&mask1).as_ref(), &None).unwrap();
{
wallet_lock_test!(wallet1.clone(), w1);
api_impl::owner::update_wallet_state(&mut **w1, (&mask1).as_ref(), &None).unwrap();
}
slate = {
let mut w_lock = wallet1.lock();
let w = w_lock.lc_provider().unwrap().wallet_inst().unwrap();
Expand Down Expand Up @@ -1273,7 +1281,10 @@ pub fn run_doctest_foreign(
}
}

api_impl::owner::update_wallet_state(wallet1.clone(), (&mask1).as_ref(), &None).unwrap();
{
wallet_lock_test!(wallet1.clone(), w1);
api_impl::owner::update_wallet_state(&mut **w1, (&mask1).as_ref(), &None).unwrap();
}
if init_tx {
let amount = 2_000_000_000;
let mut w_lock = wallet1.lock();
Expand Down
Loading