Skip to content

Commit

Permalink
updates based on upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
yeastplume committed Feb 27, 2019
1 parent 6a196ff commit 238cd72
Show file tree
Hide file tree
Showing 6 changed files with 253 additions and 332 deletions.
564 changes: 245 additions & 319 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ hyper = "0.12"
futures = "0.1"
http = "0.1"
itertools = "0.7"
lmdb-zero = "0.4.4"
rand = "0.5"
serde = "1"
log = "0.4"
Expand Down
7 changes: 4 additions & 3 deletions integration/tests/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use std::default::Default;
use std::ops::Deref;
use std::sync::Arc;
use std::{fs, thread, time};
use p2p::PeerAddr;

/// Just removes all results from previous runs
pub fn clean_all_output(test_name_dir: &str) {
Expand Down Expand Up @@ -196,7 +197,7 @@ impl LocalServerContainer {

if self.config.seed_addr.len() > 0 {
seeding_type = p2p::Seeding::List;
seeds = vec![self.config.seed_addr.to_string()];
seeds = vec![PeerAddr::from_ip(self.config.seed_addr.to_string().parse().unwrap())];
}

let s = servers::Server::new(servers::ServerConfig {
Expand Down Expand Up @@ -240,7 +241,7 @@ impl LocalServerContainer {

for p in &mut self.peer_list {
println!("{} connecting to peer: {}", self.config.p2p_server_port, p);
let _ = s.connect_peer(p.parse().unwrap());
let _ = s.connect_peer(PeerAddr::from_ip(p.parse().unwrap()));
}

if self.wallet_is_running {
Expand Down Expand Up @@ -654,7 +655,7 @@ pub fn config(n: u16, test_name_dir: &str, seed_n: u16) -> servers::ServerConfig
p2p_config: p2p::P2PConfig {
port: 10000 + n,
seeding_type: p2p::Seeding::List,
seeds: Some(vec![format!("127.0.0.1:{}", 10000 + seed_n)]),
seeds: Some(vec![PeerAddr::from_ip(format!("127.0.0.1:{}", 10000 + seed_n).parse().unwrap())]),
..p2p::P2PConfig::default()
},
chain_type: core::global::ChainTypes::AutomatedTesting,
Expand Down
6 changes: 3 additions & 3 deletions integration/tests/simulnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use self::wallet::controller;
use self::wallet::lmdb_wallet::LMDBBackend;
use self::wallet::{HTTPNodeClient, HTTPWalletCommAdapter};
use self::wallet_config::WalletConfig;
use apiwallet::{APIForeign, APIOwner};
use grin_api as api;
use grin_core as core;
use grin_keychain as keychain;
Expand All @@ -41,6 +40,7 @@ use std::default::Default;
use std::process::exit;
use std::sync::Arc;
use std::{thread, time};
use p2p::PeerAddr;

use crate::framework::{
config, stop_all_servers, LocalServerContainerConfig, LocalServerContainerPool,
Expand Down Expand Up @@ -937,7 +937,7 @@ fn replicate_tx_fluff_failure() {

// Server 2 (another node)
let mut s2_config = framework::config(3001, "tx_fluff", 3001);
s2_config.p2p_config.seeds = Some(vec!["127.0.0.1:13000".to_owned()]);
s2_config.p2p_config.seeds = Some(vec![PeerAddr::from_ip("127.0.0.1:13000".parse().unwrap())]);
s2_config.dandelion_config.embargo_secs = Some(10);
s2_config.dandelion_config.patience_secs = Some(1);
s2_config.dandelion_config.relay_secs = Some(1);
Expand All @@ -948,7 +948,7 @@ fn replicate_tx_fluff_failure() {
for i in 0..dl_nodes {
// (create some stem nodes)
let mut s_config = framework::config(3002 + i, "tx_fluff", 3002 + i);
s_config.p2p_config.seeds = Some(vec!["127.0.0.1:13000".to_owned()]);
s_config.p2p_config.seeds = Some(vec![PeerAddr::from_ip("127.0.0.1:13000".parse().unwrap())]);
s_config.dandelion_config.embargo_secs = Some(10);
s_config.dandelion_config.patience_secs = Some(1);
s_config.dandelion_config.relay_secs = Some(1);
Expand Down
4 changes: 1 addition & 3 deletions refwallet/src/lmdb_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

use std::cell::RefCell;
use std::sync::Arc;
use std::{fs, path};

// for writing storedtransaction files
Expand Down Expand Up @@ -112,8 +111,7 @@ impl<C, K> LMDBBackend<C, K> {
fs::create_dir_all(&stored_tx_path)
.expect("Couldn't create wallet backend tx storage directory!");

let lmdb_env = Arc::new(store::new_env(db_path.to_str().unwrap().to_string()));
let store = store::Store::open(lmdb_env, DB_DIR);
let store = store::Store::new(db_path.to_str().unwrap(), Some(DB_DIR), None)?;

// Make sure default wallet derivation path always exists
// as well as path (so it can be retrieved by batches to know where to store
Expand Down
3 changes: 0 additions & 3 deletions refwallet/src/test_framework/testclient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ use grin_api as api;
use grin_chain as chain;
use grin_core as core;
use grin_keychain as keychain;
use grin_store as store;
use grin_util as util;
use serde_json;
use std::collections::HashMap;
Expand Down Expand Up @@ -101,10 +100,8 @@ where
let genesis_block = pow::mine_genesis_block().unwrap();
let verifier_cache = Arc::new(RwLock::new(LruVerifierCache::new()));
let dir_name = format!("{}/.grin", chain_dir);
let db_env = Arc::new(store::new_env(dir_name.to_string()));
let c = Chain::init(
dir_name.to_string(),
db_env,
Arc::new(NoopAdapter {}),
genesis_block,
pow::verify_size,
Expand Down

0 comments on commit 238cd72

Please sign in to comment.