Optional Tor Send/Listen Functionality (#226)

* udpate for beta release

* initial tor explorations

* rustfmt

* basic tor tx send working

* rustfmt

* add tor proxy info to config file

* rustfmt

* add utilities to output tor hidden service configuration files

* output tor config as part of listener startup

* rustfmt

* fully automate config and startup of tor process

* rustfmt

* remove unnecessary process kill commands from listener

* rustfmt

* assume defaults for tor sending config if section doesn't exist in grin-wallet.toml

* rustfmt

* ignore tor dev test

* update default paths output by config, compilation + confirmed working on windows

* rustfmt

* fix on osx/unix

* add timeout to tor connector, remove unwrap in client

* allow specifiying tor address without 'http://[].onion' on the command line

* fix api test

* rustfmt

* update address derivation path as per spec

* rustfmt

* move tor init to separate function

* rustfmt

* re-ignore tor dev test

* listen on tor by default if tor available

* rustfmt

* test fix

* remove explicit send via tor flag, and assume tor if address fits

* rustfmt
This commit is contained in:
Yeastplume
2019-10-14 20:24:09 +01:00
committed by GitHub
parent c60301946f
commit b4eeb50c66
34 changed files with 2311 additions and 153 deletions
+44 -13
View File
@@ -60,8 +60,13 @@ fn command_line_test_impl(test_dir: &str) -> Result<(), grin_wallet_controller::
// add wallet to proxy
//let wallet1 = test_framework::create_wallet(&format!("{}/wallet1", test_dir), client1.clone());
let config1 = initial_setup_wallet(test_dir, "wallet1");
let (wallet1, mask1_i) =
instantiate_wallet(config1.clone(), client1.clone(), "password", "default")?;
let wallet_config1 = config1.clone().members.unwrap().wallet;
let (wallet1, mask1_i) = instantiate_wallet(
wallet_config1.clone(),
client1.clone(),
"password",
"default",
)?;
wallet_proxy.add_wallet(
"wallet1",
client1.get_send_instance(),
@@ -74,8 +79,13 @@ fn command_line_test_impl(test_dir: &str) -> Result<(), grin_wallet_controller::
execute_command(&app, test_dir, "wallet2", &client2, arg_vec.clone())?;
let config2 = initial_setup_wallet(test_dir, "wallet2");
let (wallet2, mask2_i) =
instantiate_wallet(config2.clone(), client2.clone(), "password", "default")?;
let wallet_config2 = config2.clone().members.unwrap().wallet;
let (wallet2, mask2_i) = instantiate_wallet(
wallet_config2.clone(),
client2.clone(),
"password",
"default",
)?;
wallet_proxy.add_wallet(
"wallet2",
client2.get_send_instance(),
@@ -137,8 +147,9 @@ fn command_line_test_impl(test_dir: &str) -> Result<(), grin_wallet_controller::
// Mine a bit into wallet 1 so we have something to send
// (TODO: Be able to stop listeners so we can test this better)
let wallet_config1 = config1.clone().members.unwrap().wallet;
let (wallet1, mask1_i) =
instantiate_wallet(config1.clone(), client1.clone(), "password", "default")?;
instantiate_wallet(wallet_config1, client1.clone(), "password", "default")?;
let mask1 = (&mask1_i).as_ref();
grin_wallet_controller::controller::owner_single_use(wallet1.clone(), mask1, |api, m| {
api.set_active_account(m, "mining")?;
@@ -211,8 +222,13 @@ fn command_line_test_impl(test_dir: &str) -> Result<(), grin_wallet_controller::
execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?;
bh += 1;
let (wallet1, mask1_i) =
instantiate_wallet(config1.clone(), client1.clone(), "password", "default")?;
let wallet_config1 = config1.clone().members.unwrap().wallet;
let (wallet1, mask1_i) = instantiate_wallet(
wallet_config1.clone(),
client1.clone(),
"password",
"default",
)?;
let mask1 = (&mask1_i).as_ref();
// Check our transaction log, should have 10 entries
@@ -238,8 +254,13 @@ fn command_line_test_impl(test_dir: &str) -> Result<(), grin_wallet_controller::
execute_command(&app, test_dir, "wallet2", &client1, arg_vec)?;
// check results in wallet 2
let (wallet2, mask2_i) =
instantiate_wallet(config2.clone(), client2.clone(), "password", "default")?;
let wallet_config2 = config2.clone().members.unwrap().wallet;
let (wallet2, mask2_i) = instantiate_wallet(
wallet_config2.clone(),
client2.clone(),
"password",
"default",
)?;
let mask2 = (&mask2_i).as_ref();
grin_wallet_controller::controller::owner_single_use(wallet2.clone(), mask2, |api, m| {
@@ -296,8 +317,13 @@ fn command_line_test_impl(test_dir: &str) -> Result<(), grin_wallet_controller::
bh += 1;
// Check our transaction log, should have bh entries + one for the self receive
let (wallet1, mask1_i) =
instantiate_wallet(config1.clone(), client1.clone(), "password", "default")?;
let wallet_config1 = config1.clone().members.unwrap().wallet;
let (wallet1, mask1_i) = instantiate_wallet(
wallet_config1.clone(),
client1.clone(),
"password",
"default",
)?;
let mask1 = (&mask1_i).as_ref();
grin_wallet_controller::controller::owner_single_use(wallet1.clone(), mask1, |api, m| {
@@ -332,8 +358,13 @@ fn command_line_test_impl(test_dir: &str) -> Result<(), grin_wallet_controller::
bh += 1;
// Check our transaction log, should have bh entries + 2 for the self receives
let (wallet1, mask1_i) =
instantiate_wallet(config1.clone(), client1.clone(), "password", "default")?;
let wallet_config1 = config1.clone().members.unwrap().wallet;
let (wallet1, mask1_i) = instantiate_wallet(
wallet_config1.clone(),
client1.clone(),
"password",
"default",
)?;
let mask1 = (&mask1_i).as_ref();
grin_wallet_controller::controller::owner_single_use(wallet1.clone(), mask1, |api, m| {