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

Append entries endpoint #892

Merged
merged 7 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions src/eth/rpc/rpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ fn register_methods(mut module: RpcModule<RpcContext>) -> anyhow::Result<RpcModu
module.register_async_method("stratus_readiness", stratus_readiness)?;
module.register_async_method("stratus_liveness", stratus_liveness)?;

// consensus
module.register_async_method("stratus_appendEntries", stratus_append_entries)?;

// blockchain
module.register_async_method("net_version", net_version)?;
module.register_async_method("net_listening", net_listening)?;
Expand Down Expand Up @@ -227,6 +230,9 @@ async fn stratus_liveness(_: Params<'_>, _: Arc<RpcContext>) -> anyhow::Result<J
Ok(json!(true))
}

async fn stratus_append_entries(_: Params<'_>, _: Arc<RpcContext>) -> anyhow::Result<JsonValue, RpcError> {
Ok(json!(true))
}
// Blockchain

async fn net_version(_: Params<'_>, ctx: Arc<RpcContext>) -> String {
Expand Down
2 changes: 1 addition & 1 deletion src/infra/blockchain_client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl BlockchainClient {
pub async fn append_entries(&self, entries: Vec<crate::eth::consensus::Entry>) -> anyhow::Result<()> {
tracing::debug!(?entries, "appending entries");
let entries = serde_json::to_value(entries)?;
self.http.request::<(), Vec<JsonValue>>("eth_appendEntries", vec![entries]).await?;
self.http.request::<(), Vec<JsonValue>>("stratus_appendEntries", vec![entries]).await?;
Ok(())
}

Expand Down
Loading