Skip to content
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

[r2r] hotfix to disable spv in wasm #1479

Merged
merged 3 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
15 changes: 14 additions & 1 deletion mm2src/coins/utxo/utxo_builder/utxo_coin_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use common::log::{error, info};
use common::small_rng;
use crypto::{Bip32DerPathError, Bip44DerPathError, Bip44PathToCoin, CryptoCtx, CryptoInitError, HwWalletType};
use derive_more::Display;
use futures::channel::mpsc::{channel, unbounded, Receiver as AsyncReceiver, UnboundedReceiver};
use futures::channel::mpsc::{unbounded, Receiver as AsyncReceiver, UnboundedReceiver};
use futures::compat::Future01CompatExt;
use futures::lock::Mutex as AsyncMutex;
use futures::StreamExt;
Expand All @@ -36,6 +36,7 @@ cfg_native! {
use crate::utxo::coin_daemon_data_dir;
use crate::utxo::rpc_clients::{ConcurrentRequestMap, NativeClient, NativeClientImpl};
use dirs::home_dir;
use futures::channel::mpsc::channel;
use std::path::{Path, PathBuf};
}

Expand Down Expand Up @@ -576,6 +577,18 @@ pub trait UtxoCoinBuilderCommonOps {
#[cfg(not(target_arch = "wasm32"))]
fn tx_cache_path(&self) -> PathBuf { self.ctx().dbdir().join("TX_CACHE") }

// Todo: implement spv for wasm to merge the block_header_status_channel functions
#[cfg(target_arch = "wasm32")]
fn block_header_status_channel(
&self,
) -> (
Option<UtxoSyncStatusLoopHandle>,
Option<AsyncMutex<AsyncReceiver<UtxoSyncStatus>>>,
) {
(None, None)
}

#[cfg(not(target_arch = "wasm32"))]
fn block_header_status_channel(
&self,
) -> (
Expand Down
5 changes: 5 additions & 0 deletions mm2src/coins/utxo/utxo_builder/utxo_conf_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ impl<'a> UtxoConfBuilder<'a> {

fn trezor_coin(&self) -> Option<String> { self.conf["trezor_coin"].as_str().map(|coin| coin.to_string()) }

// Todo: implement spv for wasm
#[cfg(target_arch = "wasm32")]
fn enable_spv_proof(&self) -> bool { false }

#[cfg(not(target_arch = "wasm32"))]
fn enable_spv_proof(&self) -> bool { self.conf["enable_spv_proof"].as_bool().unwrap_or(false) }

fn block_headers_verification_params(&self) -> Option<BlockHeaderVerificationParams> {
Expand Down