eth: manually unsubscribe if we break remote_subscription due to error

This commit is contained in:
dr-frmr 2024-08-08 18:15:24 +03:00
parent 81fa748d0a
commit 19a750b5e5
No known key found for this signature in database

View File

@ -470,7 +470,7 @@ async fn maintain_remote_subscription(
true,
Some(30),
IncomingReq::SubKeepalive(remote_sub_id),
&send_to_loop,
send_to_loop,
).await;
}
_incoming = net_error_rx.recv() => {
@ -487,6 +487,23 @@ async fn maintain_remote_subscription(
}
}
};
// tell provider node we don't need their services anymore
// (in case they did not close the subscription on their side,
// such as in the 2-hour timeout case)
kernel_message(
our,
rand::random(),
Address {
node: provider_node.to_string(),
process: ETH_PROCESS_ID.clone(),
},
None,
true,
None,
EthAction::UnsubscribeLogs(sub_id),
send_to_loop,
)
.await;
active_subscriptions
.entry(target.clone())
.and_modify(|sub_map| {