Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node API health check using a method not found by the Grin node. #32

Open
syntaxjak opened this issue Dec 12, 2024 · 0 comments
Open

Node API health check using a method not found by the Grin node. #32

syntaxjak opened this issue Dec 12, 2024 · 0 comments

Comments

@syntaxjak
Copy link

syntaxjak commented Dec 12, 2024

get_chain_tip ("get_tip") is not known by the grin node, causing the program to error out on a healthy node.

mwixnet.rs
...

if let Err(e) = rt_handle.block_on(node.async_get_chain_tip()) {
	eprintln!("Node communication failure. Is node listening?");
	return Err(e.into());
};

This is the corresponding function with the "get_tip" method that is not found by the grin node. Maybe change to get_status?

Node.rs

async fn async_get_chain_tip(&self) -> Result<(u64, Hash), NodeError> {
	let params = json!([]);
	let tip_json = self
		.async_send_request::<serde_json::Value>("get_tip", &params)
		.await?;
	let tip =
		serde_json::from_value::<Tip>(tip_json).map_err(NodeError::DecodeResponseError)?;

	Ok((
		tip.height,
		Hash::from_hex(tip.last_block_pushed.as_str()).unwrap(),
	))
}
@syntaxjak syntaxjak changed the title Node API health check using a method not found by the Grin node in mwixnet.rs Node API health check using a method not found by the Grin node. Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant