New flags to listen to all interfaces (#495)

* Add new flag to allow listening to all interfaces

Fix #439
Fix #494

* Fix capitalisation
This commit is contained in:
Chevdor
2018-08-09 09:00:38 +02:00
committed by Gav Wood
parent dce3e8c477
commit e7539ca444
3 changed files with 14 additions and 3 deletions
+8
View File
@@ -46,6 +46,14 @@ args:
value_name: PORT
help: Specify p2p protocol TCP port
takes_value: true
- rpc-external:
long: rpc-external
help: Listen to all RPC interfaces (default is local)
takes_value: false
- ws-external:
long: ws-external
help: Listen to all Websocket interfaces (default is local)
takes_value: false
- rpc-port:
long: rpc-port
value_name: PORT
+5 -2
View File
@@ -301,8 +301,11 @@ where
config.keys.push("Alice".into());
}
config.rpc_http = Some(parse_address("127.0.0.1:9933", "rpc-port", &matches)?);
config.rpc_ws = Some(parse_address("127.0.0.1:9944", "ws-port", &matches)?);
let rpc_interface: &str = if matches.is_present("rpc-external") { "0.0.0.0" } else { "127.0.0.1" };
let ws_interface: &str = if matches.is_present("ws-external") { "0.0.0.0" } else { "127.0.0.1" };
config.rpc_http = Some(parse_address(&format!("{}:{}", rpc_interface, 9933), "rpc-port", &matches)?);
config.rpc_ws = Some(parse_address(&format!("{}:{}", ws_interface, 9944), "ws-port", &matches)?);
// Override telemetry
if matches.is_present("no-telemetry") {
@@ -438,7 +438,7 @@ impl<T: Trait> Module<T> {
/// Returns if the account was successfully updated or update has led to killing of the account.
pub fn set_free_balance(who: &T::AccountId, balance: T::Balance) -> UpdateBalanceOutcome {
// Commented out for no - but consider it instructive.
// assert!(!Self::voting_balance(who).is_zero());
// assert!(!Self::voting_balance(who).is_zero());
if balance < Self::existential_deposit() {
Self::on_free_too_low(who);
UpdateBalanceOutcome::AccountKilled