txpipe / pallas

Rust-native building blocks for the Cardano blockchain ecosystem
Apache License 2.0
140 stars 58 forks source link

`query_has_tx` fails with `Err(Plexer(AgentDequeue))` #444

Open jonathangenlambda opened 5 months ago

jonathangenlambda commented 5 months ago

I have added the txmonitor::client to network facades, (see https://github.com/txpipe/pallas/pull/442/files) and am trying to use the mempool querying functionality now. query_size_and_capacity works repeatedly (when doing it in a loop, for example each block) perfectly fine, but query_has_tx fails with Err(Plexer(AgentDequeue)).

Here is my testcode:

async fn check_pending_tx_mempool(node_client: &mut NodeClient) {
    let monitor_client = node_client.monitor();

    let aquire_result = monitor_client.acquire().await;
    info!("aquire_result {:?}", aquire_result);

    let sac_result = monitor_client.query_size_and_capacity().await;
    info!("sac_result {:?}", sac_result);

    // this returns Err(Plexer(AgentDequeue)) 
    let has_tx_result = monitor_client.query_has_tx("fc43da88c808bbd84c394cf43d81679a4c319c21f64f9f6d9bbab57dc8bc5ff3".to_string()).await;
    info!("has_tx_result {:?}", has_tx_result);
}
jonathangenlambda commented 5 months ago

Also it seems that query_next_tx blocks forever if there is no TX in the mempool - not sure if this is the intended behaviour.

jonathangenlambda commented 5 months ago

Using a tokio timeout also doesnt work with query_next_tx as it renders the client in an invalid state ending up all subsequent requests in Err(AgencyIsTheirs):

let query_next_tx_result = monitor_client.query_next_tx();
if let Err(_) = tokio::time::timeout(Duration::from_millis(10), query_next_tx_result).await {
    info!("query_next_tx_result didnt return");
}
scarmuega commented 4 months ago

@jonathangenlambda thanks for reporting. I'll try to reproduce and then get back to you.