Skip to content
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
2 changes: 1 addition & 1 deletion mm2src/coins/lightning/ln_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ mod tests {
PaymentType::InboundPayment
};
let status_rng: u8 = rng.gen();
let status = if status_rng % 3 == 0 {
let status = if status_rng.is_multiple_of(3) {
HTLCStatus::Succeeded
} else if status_rng % 3 == 1 {
HTLCStatus::Pending
Expand Down
12 changes: 9 additions & 3 deletions mm2src/coins/nft/storage/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::eth::EthTxFeeDetails;
use crate::nft::nft_structs::{
Chain, Nft, NftList, NftListFilters, NftTokenAddrId, NftTransferHistory, NftTransferHistoryFilters,
NftsTransferHistoryList, TransferMeta,
Expand All @@ -7,11 +6,16 @@ use async_trait::async_trait;
use ethereum_types::Address;
use mm2_err_handle::mm_error::MmResult;
use mm2_err_handle::mm_error::NotMmError;
use mm2_number::{BigDecimal, BigUint};
use serde::{Deserialize, Serialize};
use mm2_number::BigUint;
use std::collections::HashSet;
use std::num::NonZeroUsize;

cfg_native! {
use crate::eth::EthTxFeeDetails;
use mm2_number::BigDecimal;
use serde::{Deserialize, Serialize};
}

#[cfg(any(test, target_arch = "wasm32"))]
pub(crate) mod db_test_helpers;
#[cfg(not(target_arch = "wasm32"))]
Expand Down Expand Up @@ -231,6 +235,7 @@ fn get_offset_limit(max: bool, limit: usize, page_number: Option<NonZeroUsize>,

/// `NftDetailsJson` structure contains immutable parameters that are not needed for queries.
/// This is what `details_json` string contains in db table.
#[cfg(not(target_arch = "wasm32"))]
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub(crate) struct NftDetailsJson {
pub(crate) owner_of: Address,
Expand All @@ -241,6 +246,7 @@ pub(crate) struct NftDetailsJson {

/// `TransferDetailsJson` structure contains immutable parameters that are not needed for queries.
/// This is what `details_json` string contains in db table.
#[cfg(not(target_arch = "wasm32"))]
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub(crate) struct TransferDetailsJson {
pub(crate) block_hash: Option<String>,
Expand Down
3 changes: 2 additions & 1 deletion mm2src/coins/z_coin/storage/walletdb/wasm/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,8 @@ impl WalletRead for WalletIndexedDb {
.cursor_builder()
.only("ticker", &self.ticker)
.map_mm_err()?
.bound("block", 0u32, u32::from(anchor_height + 1))
.only("block", u32::from(anchor_height))
.map_mm_err()?
.open_cursor(WalletDbSaplingWitnessesTable::TICKER_BLOCK_INDEX)
.await
.map_mm_err()?
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_bitcoin/keys/src/segwitaddress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ mod tests {
use Public;

fn hex_to_bytes(s: &str) -> Option<Vec<u8>> {
if s.len() % 2 == 0 {
if s.len().is_multiple_of(2) {
(0..s.len())
.step_by(2)
.map(|i| s.get(i..i + 2).and_then(|sub| u8::from_str_radix(sub, 16).ok()))
Expand Down
15 changes: 0 additions & 15 deletions mm2src/mm2_main/src/lp_ordermatch/simple_market_maker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,21 +204,6 @@ pub enum StartSimpleMakerBotError {
InternalError(String),
}

#[derive(Debug, Deserialize, Display, Serialize, SerializeErrorType)]
#[serde(tag = "error_type", content = "error_data")]
pub enum SwapUpdateNotificationError {
#[display(fmt = "{_0}")]
MyRecentSwapsError(LatestSwapsErr),
#[display(fmt = "Swap info not available")]
SwapInfoNotAvailable,
}

impl From<LatestSwapsErr> for SwapUpdateNotificationError {
fn from(e: LatestSwapsErr) -> Self {
SwapUpdateNotificationError::MyRecentSwapsError(e)
}
}

impl HttpStatusCode for StartSimpleMakerBotError {
fn status_code(&self) -> StatusCode {
match self {
Expand Down
7 changes: 1 addition & 6 deletions mm2src/mm2_main/src/lp_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use mm2_libp2p::application::request_response::network_info::NetworkInfoRequest;
use mm2_libp2p::{encode_message, NetworkInfo, PeerId, RelayAddress, RelayAddressError};
use mm2_net::ip_addr::ParseAddressError;
use serde_json::{self as json, Value as Json};
use std::collections::{HashMap, HashSet};
use std::collections::HashSet;
use std::convert::TryInto;
use std::sync::Arc;

Expand Down Expand Up @@ -182,11 +182,6 @@ pub async fn remove_node_from_version_stat(ctx: MmArc, req: Json) -> NodeVersion
Ok("success".into())
}

#[derive(Debug, Deserialize, Serialize)]
struct Mm2VersionRes {
nodes: HashMap<String, String>,
}

fn process_get_version_request(ctx: MmArc) -> Result<Vec<u8>, String> {
let response = ctx.mm_version().to_string();
encode_message(&response).map_err(|e| e.to_string())
Expand Down
4 changes: 3 additions & 1 deletion mm2src/mm2_test_helpers/src/for_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use mm2_metrics::{MetricType, MetricsJson};
use mm2_number::BigDecimal;
use mm2_rpc::data::legacy::{BalanceResponse, ElectrumProtocol};
use rand::Rng;
use serde::{Deserialize, Serialize};
use serde::Serialize;
use serde_json::{self as json, json, Value as Json};
use std::collections::HashMap;
use std::convert::TryFrom;
Expand All @@ -41,6 +41,7 @@ cfg_native! {
use futures::task::SpawnExt;
use http::Request;
use regex::Regex;
use serde::Deserialize;
use std::fs;
use std::io::Write;
use std::net::Ipv4Addr;
Expand Down Expand Up @@ -1844,6 +1845,7 @@ where
}
}

#[cfg(not(target_arch = "wasm32"))]
#[derive(Serialize, Deserialize, Debug)]
struct ToWaitForLogRe {
ctx: u32,
Expand Down
Loading