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

Add an system_syncState RPC method #7315

Merged
merged 2 commits into from
Oct 13, 2020
Merged

Add an system_syncState RPC method #7315

merged 2 commits into from
Oct 13, 2020

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Oct 13, 2020

Fix #5727

(I don't know who to ask for a review)

Example usage:

curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"system_syncState","params":[],"id":1}' localhost:9933
{"jsonrpc":"2.0","result":{"currentBlock":2903,"highestBlock":173020,"startingBlock":2738},"id":1}

The highestBlock field will be missing for a short duration after the node starts.

@tomaka tomaka added A0-please_review Pull request needs code review. B5-clientnoteworthy C1-low PR touches the given topic and has a low impact on builders. labels Oct 13, 2020
pub highest_block: Option<Number>,
}

fn none<T>() -> Option<T> { None }
Copy link
Contributor Author

@tomaka tomaka Oct 13, 2020

Choose a reason for hiding this comment

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

Note: if I try use #[serde(default)] instead, I get a compilation error saying that Number doesn't implement Default, which I don't understand.

@@ -44,6 +44,7 @@ lazy_static = { version = "1.4.0", optional = true }
[dev-dependencies]
assert_matches = "1.3.0"
futures01 = { package = "futures", version = "0.1.29" }
lazy_static = "1.4.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

cargo test in client/rpc fails to compile without this line.

client/rpc-api/src/system/helpers.rs Outdated Show resolved Hide resolved
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Copy link
Contributor

@Stefie Stefie left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks for taking it on!

@bkchr bkchr merged commit 07c1397 into paritytech:master Oct 13, 2020
@tomaka tomaka deleted the fix-5727 branch October 13, 2020 16:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When syncing, add target block via RPC
3 participants