mempool: fixes

This commit is contained in:
nym21
2026-05-06 19:31:18 +02:00
parent 086bfd9938
commit cb74087f27
10 changed files with 157 additions and 209 deletions
+19
View File
@@ -32,6 +32,25 @@ impl MempoolRoutes for ApiRouter<AppState> {
},
),
)
.api_route(
"/api/mempool/hash",
get_with(
async |uri: Uri, headers: HeaderMap, _: Empty, State(state): State<AppState>| {
state
.respond_json(&headers, state.mempool_strategy(), &uri, |q| q.mempool_hash())
.await
},
|op| {
op.id("get_mempool_hash")
.mempool_tag()
.summary("Mempool content hash")
.description("Returns an opaque `u64` that changes whenever the projected next block changes. Same value as the mempool ETag. Useful as a freshness/liveness signal: if it stays constant for tens of seconds on a live network, the mempool sync loop has stalled.")
.json_response::<u64>()
.not_modified()
.server_error()
},
),
)
.api_route(
"/api/mempool/txids",
get_with(