automatic retry for eth_getTransactionReceipt and eth_getTransactionByHash
thanks for the report Lefteris @ Rotki
This commit is contained in:
parent
ffb554d0b3
commit
aff53ce36a
@ -1564,6 +1564,37 @@ impl Web3ProxyApp {
|
|||||||
|
|
||||||
JsonRpcForwardedResponse::from_value(json!(gas_estimate), request_id)
|
JsonRpcForwardedResponse::from_value(json!(gas_estimate), request_id)
|
||||||
}
|
}
|
||||||
|
"eth_getTransactionReceipt" | "eth_getTransactionByHash" => {
|
||||||
|
// try to get the transaction without specifying a min_block_height
|
||||||
|
let mut response = self
|
||||||
|
.balanced_rpcs
|
||||||
|
.try_proxy_connection(
|
||||||
|
authorization,
|
||||||
|
request,
|
||||||
|
Some(&request_metadata),
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
// if we got "null", it is probably because the tx is old. retry requiring nodes with old block data
|
||||||
|
if let Some(ref result) = response.result {
|
||||||
|
if result.get() == "null" {
|
||||||
|
response = self
|
||||||
|
.balanced_rpcs
|
||||||
|
.try_proxy_connection(
|
||||||
|
authorization,
|
||||||
|
request,
|
||||||
|
Some(&request_metadata),
|
||||||
|
Some(&U64::one()),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
response
|
||||||
|
}
|
||||||
// TODO: eth_gasPrice that does awesome magic to predict the future
|
// TODO: eth_gasPrice that does awesome magic to predict the future
|
||||||
"eth_hashrate" => JsonRpcForwardedResponse::from_value(json!(U64::zero()), request_id),
|
"eth_hashrate" => JsonRpcForwardedResponse::from_value(json!(U64::zero()), request_id),
|
||||||
"eth_mining" => {
|
"eth_mining" => {
|
||||||
|
Loading…
Reference in New Issue
Block a user