Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Add Error message when sync is still in progress. #9475

Merged
merged 19 commits into from
Nov 26, 2018
Merged
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions parity/cli/mod.rs
Original file line number Diff line number Diff line change
@@ -463,6 +463,10 @@ usage! {


["API and Console Options – HTTP JSON-RPC"]
FLAG flag_jsonrpc_allow_missing_blocks: (bool) = false, or |c: &Config| c.rpc.as_ref()?.jsonrpc_allow_missing_blocks.clone(),
"--jsonrpc-allow-missing-blocks",
"RPC calls will return 'null' instead of an error if ancient block sync is still in progress and the block information requested could not be found",

FLAG flag_no_jsonrpc: (bool) = false, or |c: &Config| c.rpc.as_ref()?.disable.clone(),
"--no-jsonrpc",
"Disable the HTTP JSON-RPC API server.",
@@ -1230,6 +1234,7 @@ struct Rpc {
keep_alive: Option<bool>,
experimental_rpcs: Option<bool>,
poll_lifetime: Option<u32>,
jsonrpc_allow_missing_blocks: Option<bool>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe name this just allow_missing_blocks? We need the jsonrpc prefix for args but they're already under the category for configs.

}

#[derive(Default, Debug, PartialEq, Deserialize)]
@@ -1697,6 +1702,7 @@ mod tests {
arg_jsonrpc_threads: 4,
arg_jsonrpc_max_payload: None,
arg_poll_lifetime: 60u32,
flag_jsonrpc_allow_missing_blocks: false,

// WS
flag_no_ws: false,
@@ -1973,6 +1979,7 @@ mod tests {
keep_alive: None,
experimental_rpcs: None,
poll_lifetime: None,
jsonrpc_allow_missing_blocks: None
}),
ipc: Some(Ipc {
disable: None,
1 change: 1 addition & 0 deletions parity/cli/tests/config.full.toml
Original file line number Diff line number Diff line change
@@ -64,6 +64,7 @@ interface = "local"
cors = ["null"]
apis = ["web3", "eth", "net", "parity", "traces", "rpc", "secretstore"]
hosts = ["none"]
jsonrpc_allow_missing_blocks = false

[websockets]
disable = false
2 changes: 2 additions & 0 deletions parity/configuration.rs
Original file line number Diff line number Diff line change
@@ -370,6 +370,7 @@ impl Configuration {
miner_extras: self.miner_extras()?,
stratum: self.stratum_options()?,
update_policy: update_policy,
jsonrpc_allow_missing_blocks: self.args.flag_jsonrpc_allow_missing_blocks,
mode: mode,
tracing: tracing,
fat_db: fat_db,
@@ -1390,6 +1391,7 @@ mod tests {
let args = vec!["parity"];
let conf = parse(&args);
let mut expected = RunCmd {
jsonrpc_allow_missing_blocks: false,
cache_config: Default::default(),
dirs: Default::default(),
spec: Default::default(),
Loading