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

fix: read stacks-core http event POST payloads for ignored events #673

Merged
merged 2 commits into from
Oct 31, 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
4 changes: 2 additions & 2 deletions components/chainhook-cli/src/service/tests/observer_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ async fn start_and_ping_event_observer(config: EventObserverConfig, ingestion_po
.unwrap();
await_observer_started(ingestion_port).await;
}
#[test_case("/drop_mempool_tx", Method::POST, None)]
#[test_case("/attachments/new", Method::POST, None)]
#[test_case("/drop_mempool_tx", Method::POST, Some(&json!({})))]
#[test_case("/attachments/new", Method::POST, Some(&json!({})))]
#[test_case("/mined_block", Method::POST, Some(&json!({})))]
#[test_case("/mined_microblock", Method::POST, Some(&json!({})))]
#[tokio::test]
Expand Down
12 changes: 6 additions & 6 deletions components/chainhook-sdk/src/observer/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,19 +301,19 @@ pub fn handle_new_mempool_tx(
success_response()
}

#[post("/drop_mempool_tx", format = "application/json")]
pub fn handle_drop_mempool_tx(ctx: &State<Context>) -> Json<JsonValue> {
ctx.try_log(|logger| slog::debug!(logger, "POST /drop_mempool_tx"));
#[post("/drop_mempool_tx", format = "application/json", data = "<payload>")]
pub fn handle_drop_mempool_tx(payload: Json<JsonValue>, ctx: &State<Context>) -> Json<JsonValue> {
ctx.try_log(|logger| slog::debug!(logger, "POST /drop_mempool_tx {:?}", payload));
// TODO(lgalabru): use propagate mempool events
Json(json!({
"status": 200,
"result": "Ok",
}))
}

#[post("/attachments/new", format = "application/json")]
pub fn handle_new_attachement(ctx: &State<Context>) -> Json<JsonValue> {
ctx.try_log(|logger| slog::debug!(logger, "POST /attachments/new"));
#[post("/attachments/new", format = "application/json", data = "<payload>")]
pub fn handle_new_attachement(payload: Json<JsonValue>, ctx: &State<Context>) -> Json<JsonValue> {
ctx.try_log(|logger| slog::debug!(logger, "POST /attachments/new {:?}", payload));
Json(json!({
"status": 200,
"result": "Ok",
Expand Down
Loading