Skip to content

Commit aa714ac

Browse files
Make the query code blocks more readable
1 parent 8e37e1f commit aa714ac

File tree

1 file changed

+10
-24
lines changed
  • aggregation_mode/batcher/src/server

1 file changed

+10
-24
lines changed

aggregation_mode/batcher/src/server/http.rs

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -208,34 +208,20 @@ impl BatcherServer {
208208

209209
let address = params.address.to_lowercase();
210210

211-
let receipts = if let Some(nonce) = params.nonce {
212-
match state
211+
let query = if let Some(nonce) = params.nonce {
212+
state
213213
.db
214214
.get_tasks_by_address_and_nonce(&address, nonce)
215215
.await
216-
{
217-
Ok(receipts) => receipts,
218-
Err(_) => {
219-
return HttpResponse::InternalServerError().json(
220-
AppResponse::new_unsucessfull(
221-
"Internal server error: Failed to get tasks by address and nonce",
222-
500,
223-
),
224-
);
225-
}
226-
}
227216
} else {
228-
match state.db.get_tasks_by_address(&address, 100).await {
229-
Ok(receipts) => receipts,
230-
Err(_) => {
231-
return HttpResponse::InternalServerError().json(
232-
AppResponse::new_unsucessfull(
233-
"Internal server error: Failed to get tasks by address and nonce",
234-
500,
235-
),
236-
);
237-
}
238-
}
217+
state.db.get_tasks_by_address(&address, 100).await
218+
};
219+
220+
let Ok(receipts) = query else {
221+
return HttpResponse::InternalServerError().json(AppResponse::new_unsucessfull(
222+
"Internal server error: Failed to get tasks by address and nonce",
223+
500,
224+
));
239225
};
240226

241227
match format_merkle_paths(receipts) {

0 commit comments

Comments
 (0)