Feature/slate serialization (#2534)
* - Add backwards compatability - Add hex serialization * rustfmt * rustfmt * Windows Compatibility Fixes #1 (#2535) * initial changes for windows build and unit/integration tests * rustfmt * wallet+store tests * rustfmt * fix linux daemonize * better encapsulate file rename * rustfmt * remove daemonize commands * rustfmt * remove server start/stop commands * add ability to drop pmmr backend files explicitly for txhashset unzip * rustfmt * fix pmmr tests * rustfmt * Windows TUI Fix (#2555) * switch pancurses backend to win32 * revert changes to restore test * compatibility fix + debug messages * rustfmt * Add content disposition for OK responses (#2545) * Testing http send and fixing accordingly * add repost method into wallet owner api (#2553) * add repost method into wallet owner api * rustfmt * Add ability to compare selection strategies (#2516) Before tx creation user can estimate fee and locked amount with different selection strategies by providing `-e` flag for `wallet send` command.
This commit is contained in:
committed by
Yeastplume
parent
0d36acf01b
commit
ee4eed71ea
+2
-20
@@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
/// Grin server commands processing
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
use std::env::current_dir;
|
||||
use std::process::exit;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
@@ -22,7 +23,6 @@ use std::time::Duration;
|
||||
|
||||
use clap::ArgMatches;
|
||||
use ctrlc;
|
||||
use daemonize::Daemonize;
|
||||
|
||||
use crate::config::GlobalConfig;
|
||||
use crate::core::global;
|
||||
@@ -31,7 +31,7 @@ use crate::servers;
|
||||
use crate::tui::ui;
|
||||
|
||||
/// wrap below to allow UI to clean up on stop
|
||||
fn start_server(config: servers::ServerConfig) {
|
||||
pub fn start_server(config: servers::ServerConfig) {
|
||||
start_server_tui(config);
|
||||
// Just kill process for now, otherwise the process
|
||||
// hangs around until sigint because the API server
|
||||
@@ -157,29 +157,11 @@ pub fn server_command(
|
||||
});
|
||||
}*/
|
||||
|
||||
// start the server in the different run modes (interactive or daemon)
|
||||
if let Some(a) = server_args {
|
||||
match a.subcommand() {
|
||||
("run", _) => {
|
||||
start_server(server_config);
|
||||
}
|
||||
("start", _) => {
|
||||
let daemonize = Daemonize::new()
|
||||
.pid_file("/tmp/grin.pid")
|
||||
.chown_pid_file(true)
|
||||
.working_directory(current_dir().unwrap())
|
||||
.privileged_action(move || {
|
||||
start_server(server_config.clone());
|
||||
loop {
|
||||
thread::sleep(Duration::from_secs(60));
|
||||
}
|
||||
});
|
||||
match daemonize.start() {
|
||||
Ok(_) => info!("Grin server successfully started."),
|
||||
Err(e) => error!("Error starting: {}", e),
|
||||
}
|
||||
}
|
||||
("stop", _) => println!("TODO. Just 'kill $pid' for now. Maybe /tmp/grin.pid is $pid"),
|
||||
("", _) => {
|
||||
println!("Subcommand required, use 'grin help server' for details");
|
||||
}
|
||||
|
||||
@@ -349,6 +349,9 @@ pub fn parse_send_args(args: &ArgMatches) -> Result<command::SendArgs, ParseErro
|
||||
// selection_strategy
|
||||
let selection_strategy = parse_required(args, "selection_strategy")?;
|
||||
|
||||
// estimate_selection_strategies
|
||||
let estimate_selection_strategies = args.is_present("estimate_selection_strategies");
|
||||
|
||||
// method
|
||||
let method = parse_required(args, "method")?;
|
||||
|
||||
@@ -360,10 +363,18 @@ pub fn parse_send_args(args: &ArgMatches) -> Result<command::SendArgs, ParseErro
|
||||
None => "default",
|
||||
}
|
||||
} else {
|
||||
parse_required(args, "dest")?
|
||||
if !estimate_selection_strategies {
|
||||
parse_required(args, "dest")?
|
||||
} else {
|
||||
""
|
||||
}
|
||||
}
|
||||
};
|
||||
if method == "http" && !dest.starts_with("http://") && !dest.starts_with("https://") {
|
||||
if !estimate_selection_strategies
|
||||
&& method == "http"
|
||||
&& !dest.starts_with("http://")
|
||||
&& !dest.starts_with("https://")
|
||||
{
|
||||
let msg = format!(
|
||||
"HTTP Destination should start with http://: or https://: {}",
|
||||
dest,
|
||||
@@ -386,6 +397,7 @@ pub fn parse_send_args(args: &ArgMatches) -> Result<command::SendArgs, ParseErro
|
||||
message: message,
|
||||
minimum_confirmations: min_c,
|
||||
selection_strategy: selection_strategy.to_owned(),
|
||||
estimate_selection_strategies,
|
||||
method: method.to_owned(),
|
||||
dest: dest.to_owned(),
|
||||
change_outputs: change_outputs,
|
||||
@@ -562,7 +574,11 @@ pub fn wallet_command(
|
||||
}
|
||||
("send", Some(args)) => {
|
||||
let a = arg_parse!(parse_send_args(&args));
|
||||
command::send(inst_wallet(), a)
|
||||
command::send(
|
||||
inst_wallet(),
|
||||
a,
|
||||
wallet_config.dark_background_color_scheme.unwrap_or(true),
|
||||
)
|
||||
}
|
||||
("receive", Some(args)) => {
|
||||
let a = arg_parse!(parse_receive_args(&args));
|
||||
|
||||
+4
-4
@@ -44,10 +44,6 @@ subcommands:
|
||||
subcommands:
|
||||
- config:
|
||||
about: Generate a configuration grin-server.toml file in the current directory
|
||||
- start:
|
||||
about: Start the Grin server as a daemon
|
||||
- stop:
|
||||
about: Stop the Grin server daemon
|
||||
- run:
|
||||
about: Run the Grin server in this console
|
||||
- client:
|
||||
@@ -161,6 +157,10 @@ subcommands:
|
||||
- smallest
|
||||
default_value: all
|
||||
takes_value: true
|
||||
- estimate_selection_strategies:
|
||||
help: Estimates all possible Coin/Output selection strategies.
|
||||
short: e
|
||||
long: estimate-selection
|
||||
- change_outputs:
|
||||
help: Number of change outputs to generate (mainly for testing)
|
||||
short: o
|
||||
|
||||
Reference in New Issue
Block a user