mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-10-17 07:11:36 +02:00
use local chain_type and global chain_type as necessary
This commit is contained in:
@@ -102,6 +102,7 @@ where
|
||||
/// ```
|
||||
/// use grin_wallet_util::grin_keychain as keychain;
|
||||
/// use grin_wallet_util::grin_util as util;
|
||||
/// use grin_wallet_util::grin_core;
|
||||
/// use grin_wallet_api as api;
|
||||
/// use grin_wallet_config as config;
|
||||
/// use grin_wallet_impls as impls;
|
||||
@@ -113,11 +114,15 @@ where
|
||||
/// use std::sync::Arc;
|
||||
/// use util::{Mutex, ZeroingString};
|
||||
///
|
||||
/// use grin_core::global;
|
||||
///
|
||||
/// use api::Foreign;
|
||||
/// use config::WalletConfig;
|
||||
/// use impls::{DefaultWalletImpl, DefaultLCProvider, HTTPNodeClient};
|
||||
/// use libwallet::WalletInst;
|
||||
///
|
||||
/// global::init_global_chain_type(global::ChainTypes::Mainnet);
|
||||
///
|
||||
/// let mut wallet_config = WalletConfig::default();
|
||||
/// # let dir = tempdir().map_err(|e| format!("{:#?}", e)).unwrap();
|
||||
/// # let dir = dir
|
||||
@@ -406,9 +411,11 @@ macro_rules! doctest_helper_setup_doc_env_foreign {
|
||||
use grin_wallet_config as config;
|
||||
use grin_wallet_impls as impls;
|
||||
use grin_wallet_libwallet as libwallet;
|
||||
use grin_wallet_util::grin_core;
|
||||
use grin_wallet_util::grin_keychain as keychain;
|
||||
use grin_wallet_util::grin_util as util;
|
||||
|
||||
use grin_core::global;
|
||||
use keychain::ExtKeychain;
|
||||
use tempfile::tempdir;
|
||||
|
||||
@@ -420,6 +427,8 @@ macro_rules! doctest_helper_setup_doc_env_foreign {
|
||||
use impls::{DefaultLCProvider, DefaultWalletImpl, HTTPNodeClient};
|
||||
use libwallet::{BlockFees, IssueInvoiceTxArgs, Slate, WalletInst};
|
||||
|
||||
global::init_global_chain_type(global::ChainTypes::Mainnet);
|
||||
|
||||
let dir = tempdir().map_err(|e| format!("{:#?}", e)).unwrap();
|
||||
let dir = dir
|
||||
.path()
|
||||
|
||||
@@ -360,7 +360,7 @@ pub fn run_doctest_foreign(
|
||||
|
||||
util::init_test_logger();
|
||||
let _ = fs::remove_dir_all(test_dir);
|
||||
global::set_mining_mode(ChainTypes::AutomatedTesting);
|
||||
global::set_local_chain_type(ChainTypes::AutomatedTesting);
|
||||
|
||||
let mut wallet_proxy: WalletProxy<
|
||||
DefaultLCProvider<LocalWalletClient, ExtKeychain>,
|
||||
|
||||
@@ -109,11 +109,13 @@ where
|
||||
/// ```
|
||||
/// use grin_wallet_util::grin_keychain as keychain;
|
||||
/// use grin_wallet_util::grin_util as util;
|
||||
/// use grin_wallet_util::grin_core;
|
||||
/// use grin_wallet_api as api;
|
||||
/// use grin_wallet_config as config;
|
||||
/// use grin_wallet_impls as impls;
|
||||
/// use grin_wallet_libwallet as libwallet;
|
||||
///
|
||||
/// use grin_core::global;
|
||||
/// use keychain::ExtKeychain;
|
||||
/// use tempfile::tempdir;
|
||||
///
|
||||
@@ -125,6 +127,8 @@ where
|
||||
/// use impls::{DefaultWalletImpl, DefaultLCProvider, HTTPNodeClient};
|
||||
/// use libwallet::WalletInst;
|
||||
///
|
||||
/// global::init_global_chain_type(global::ChainTypes::Mainnet);
|
||||
///
|
||||
/// let mut wallet_config = WalletConfig::default();
|
||||
/// # let dir = tempdir().map_err(|e| format!("{:#?}", e)).unwrap();
|
||||
/// # let dir = dir
|
||||
@@ -2113,6 +2117,8 @@ macro_rules! doctest_helper_setup_doc_env {
|
||||
use grin_wallet_util::grin_keychain as keychain;
|
||||
use grin_wallet_util::grin_util as util;
|
||||
|
||||
use grin_core::global;
|
||||
|
||||
use keychain::ExtKeychain;
|
||||
use tempfile::tempdir;
|
||||
|
||||
@@ -2126,6 +2132,10 @@ macro_rules! doctest_helper_setup_doc_env {
|
||||
|
||||
use uuid::Uuid;
|
||||
|
||||
// Various levels of magic going on in these doctests and we need to ensure
|
||||
// the global chain_type is set correctly.
|
||||
global::init_global_chain_type(global::ChainTypes::Mainnet);
|
||||
|
||||
let dir = tempdir().map_err(|e| format!("{:#?}", e)).unwrap();
|
||||
let dir = dir
|
||||
.path()
|
||||
|
||||
@@ -1937,7 +1937,7 @@ pub fn run_doctest_owner(
|
||||
|
||||
util::init_test_logger();
|
||||
let _ = fs::remove_dir_all(test_dir);
|
||||
global::set_mining_mode(ChainTypes::AutomatedTesting);
|
||||
global::set_local_chain_type(ChainTypes::AutomatedTesting);
|
||||
|
||||
let mut wallet_proxy: WalletProxy<
|
||||
DefaultLCProvider<LocalWalletClient, ExtKeychain>,
|
||||
|
||||
Reference in New Issue
Block a user