only check if we have block if we subscribe

This commit is contained in:
Bryan Stitt 2023-11-01 22:45:20 -07:00
parent 715e96119a
commit 53b4eacaa7

View File

@ -1167,7 +1167,8 @@ impl Web3Rpc {
return Ok(OpenRequestResult::Failed);
}
// make sure this block has the oldest block that this request needs
if self.block_and_rpc_sender.is_some() {
// make sure this rpc has the oldest block that this request needs
if let Some(block_needed) = web3_request.min_block_needed() {
if !self.has_block_data(block_needed) {
trace!(%web3_request, %block_needed, "{} cannot serve this request. Missing min block", self);
@ -1175,7 +1176,7 @@ impl Web3Rpc {
}
}
// make sure this block has the newest block that this request needs
// make sure this rpc has the newest block that this request needs
if let Some(block_needed) = web3_request.max_block_needed() {
if !self.has_block_data(block_needed) {
trace!(%web3_request, %block_needed, "{} cannot serve this request. Missing max block", self);
@ -1248,6 +1249,7 @@ impl Web3Rpc {
}
}
}
}
// check rate limits
match self.try_throttle().await? {