handle empty private_rpcs
This commit is contained in:
parent
c8bc0d288f
commit
499d50b5fc
@ -1265,7 +1265,7 @@ impl Web3ProxyApp {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let (private_rpcs, num) = if let Some(private_rpcs) = self.private_rpcs.as_ref() {
|
let (private_rpcs, num) = if let Some(private_rpcs) = self.private_rpcs.as_ref() {
|
||||||
if authorization.checks.private_txs {
|
if !private_rpcs.is_empty() && authorization.checks.private_txs {
|
||||||
// if we are sending the transaction privately, no matter the proxy_mode, we send to ALL private rpcs
|
// if we are sending the transaction privately, no matter the proxy_mode, we send to ALL private rpcs
|
||||||
(private_rpcs, None)
|
(private_rpcs, None)
|
||||||
} else {
|
} else {
|
||||||
@ -1283,12 +1283,13 @@ impl Web3ProxyApp {
|
|||||||
// TODO: error/wait if no head block!
|
// TODO: error/wait if no head block!
|
||||||
|
|
||||||
// try_send_all_upstream_servers puts the request id into the response. no need to do that ourselves here.
|
// try_send_all_upstream_servers puts the request id into the response. no need to do that ourselves here.
|
||||||
|
// TODO: what lag should we allow?
|
||||||
let mut response = private_rpcs
|
let mut response = private_rpcs
|
||||||
.try_send_all_synced_connections(
|
.try_send_all_synced_connections(
|
||||||
authorization,
|
authorization,
|
||||||
&request,
|
&request,
|
||||||
Some(request_metadata.clone()),
|
Some(request_metadata.clone()),
|
||||||
None,
|
Some(&head_block_num.saturating_sub(2.into())),
|
||||||
None,
|
None,
|
||||||
Level::Trace,
|
Level::Trace,
|
||||||
num,
|
num,
|
||||||
|
@ -315,6 +315,14 @@ impl Web3Rpcs {
|
|||||||
self.by_name.read().get(conn_name).cloned()
|
self.by_name.read().get(conn_name).cloned()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn len(&self) -> usize {
|
||||||
|
self.by_name.read().len()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
self.by_name.read().is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn min_head_rpcs(&self) -> usize {
|
pub fn min_head_rpcs(&self) -> usize {
|
||||||
self.min_head_rpcs
|
self.min_head_rpcs
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user