Merge branch 'master' of github.com:ethcore/parity into move_hash
This commit is contained in:
@@ -14,6 +14,7 @@ serde = "0.7.0"
|
||||
serde_json = "0.7.0"
|
||||
jsonrpc-core = "2.0"
|
||||
jsonrpc-http-server = { git = "https://github.com/ethcore/jsonrpc-http-server.git" }
|
||||
ethcore-io = { path = "../util/io" }
|
||||
ethcore-util = { path = "../util" }
|
||||
ethcore = { path = "../ethcore" }
|
||||
ethash = { path = "../ethash" }
|
||||
|
||||
@@ -28,6 +28,7 @@ extern crate jsonrpc_core;
|
||||
extern crate jsonrpc_http_server;
|
||||
#[macro_use]
|
||||
extern crate ethcore_util as util;
|
||||
extern crate ethcore_io as io;
|
||||
extern crate ethcore;
|
||||
extern crate ethsync;
|
||||
extern crate transient_hashmap;
|
||||
@@ -41,12 +42,12 @@ extern crate ethcore_devtools as devtools;
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::net::SocketAddr;
|
||||
use util::panics::PanicHandler;
|
||||
use io::PanicHandler;
|
||||
use self::jsonrpc_core::{IoHandler, IoDelegate};
|
||||
|
||||
pub use jsonrpc_http_server::{ServerBuilder, Server, RpcServerError};
|
||||
pub mod v1;
|
||||
pub use v1::{SigningQueue, ConfirmationsQueue};
|
||||
pub use v1::{SigningQueue, ConfirmationsQueue, NetworkSettings};
|
||||
|
||||
/// An object that can be extended with `IoDelegates`
|
||||
pub trait Extendable {
|
||||
|
||||
@@ -18,8 +18,10 @@ mod poll_manager;
|
||||
mod poll_filter;
|
||||
mod requests;
|
||||
mod signing_queue;
|
||||
mod network_settings;
|
||||
|
||||
pub use self::poll_manager::PollManager;
|
||||
pub use self::poll_filter::PollFilter;
|
||||
pub use self::requests::{TransactionRequest, FilledTransactionRequest, ConfirmationRequest, ConfirmationPayload, CallRequest};
|
||||
pub use self::signing_queue::{ConfirmationsQueue, ConfirmationPromise, ConfirmationResult, SigningQueue, QueueEvent};
|
||||
pub use self::network_settings::NetworkSettings;
|
||||
|
||||
52
rpc/src/v1/helpers/network_settings.rs
Normal file
52
rpc/src/v1/helpers/network_settings.rs
Normal file
@@ -0,0 +1,52 @@
|
||||
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
//! Structure to hold network settings configured from CLI
|
||||
|
||||
/// Networking & RPC settings
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub struct NetworkSettings {
|
||||
/// Node name
|
||||
pub name: String,
|
||||
/// Name of the chain we are connected to
|
||||
pub chain: String,
|
||||
/// Min number of peers
|
||||
pub min_peers: u32,
|
||||
/// Max number of peers
|
||||
pub max_peers: u32,
|
||||
/// Networking port
|
||||
pub network_port: u16,
|
||||
/// Is JSON-RPC server enabled?
|
||||
pub rpc_enabled: bool,
|
||||
/// Interface that JSON-RPC listens on
|
||||
pub rpc_interface: String,
|
||||
/// Port for JSON-RPC server
|
||||
pub rpc_port: u16,
|
||||
}
|
||||
|
||||
impl Default for NetworkSettings {
|
||||
fn default() -> Self {
|
||||
NetworkSettings {
|
||||
name: "".into(),
|
||||
chain: "homestead".into(),
|
||||
min_peers: 25,
|
||||
max_peers: 50,
|
||||
network_port: 30303,
|
||||
rpc_enabled: true,
|
||||
rpc_interface: "local".into(),
|
||||
rpc_port: 8545
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
//! Ethcore-specific rpc implementation.
|
||||
use util::{RotatingLogger};
|
||||
use util::network_settings::NetworkSettings;
|
||||
use util::misc::version_data;
|
||||
use std::sync::{Arc, Weak};
|
||||
use std::ops::Deref;
|
||||
@@ -26,7 +25,7 @@ use jsonrpc_core::*;
|
||||
use ethcore::miner::MinerService;
|
||||
use v1::traits::Ethcore;
|
||||
use v1::types::{Bytes, U256};
|
||||
use v1::helpers::{SigningQueue, ConfirmationsQueue};
|
||||
use v1::helpers::{SigningQueue, ConfirmationsQueue, NetworkSettings};
|
||||
use v1::impls::signer_disabled_error;
|
||||
|
||||
/// Ethcore implementation.
|
||||
|
||||
@@ -27,4 +27,4 @@ pub mod types;
|
||||
|
||||
pub use self::traits::{Web3, Eth, EthFilter, EthSigning, Personal, PersonalSigner, Net, Ethcore, EthcoreSet, Traces, Rpc};
|
||||
pub use self::impls::*;
|
||||
pub use self::helpers::{SigningQueue, ConfirmationsQueue};
|
||||
pub use self::helpers::{SigningQueue, ConfirmationsQueue, NetworkSettings};
|
||||
|
||||
@@ -29,7 +29,7 @@ use ethcore::miner::{MinerOptions, GasPricer, MinerService, ExternalMiner, Miner
|
||||
use ethcore::account_provider::AccountProvider;
|
||||
use devtools::RandomTempPath;
|
||||
use util::Hashable;
|
||||
use util::io::IoChannel;
|
||||
use io::IoChannel;
|
||||
use util::{U256, H256, Uint};
|
||||
use jsonrpc_core::IoHandler;
|
||||
use ethjson::blockchain::BlockChain;
|
||||
|
||||
@@ -21,7 +21,7 @@ use v1::tests::helpers::TestMinerService;
|
||||
use v1::helpers::ConfirmationsQueue;
|
||||
use ethcore::client::{TestBlockChainClient};
|
||||
use util::log::RotatingLogger;
|
||||
use util::network_settings::NetworkSettings;
|
||||
use v1::helpers::NetworkSettings;
|
||||
|
||||
fn miner_service() -> Arc<TestMinerService> {
|
||||
Arc::new(TestMinerService::default())
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use ethsync::{ManageNetwork, NetworkConfiguration};
|
||||
use util;
|
||||
|
||||
pub struct TestManageNetwork;
|
||||
|
||||
@@ -27,5 +26,5 @@ impl ManageNetwork for TestManageNetwork {
|
||||
fn add_reserved_peer(&self, _peer: String) -> Result<(), String> { Ok(()) }
|
||||
fn start_network(&self) {}
|
||||
fn stop_network(&self) {}
|
||||
fn network_config(&self) -> NetworkConfiguration { NetworkConfiguration::from(util::NetworkConfiguration::new_local()) }
|
||||
fn network_config(&self) -> NetworkConfiguration { NetworkConfiguration::new_local() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user