diff --git a/TODO.md b/TODO.md index 1a35095c..6ca8ddf9 100644 --- a/TODO.md +++ b/TODO.md @@ -298,6 +298,7 @@ These are not yet ordered. There might be duplicates. We might not actually need - [x] ip detection needs work so that everything doesnt show up as 172.x.x.x - i think this was done, but am not positive. - [x] if private txs are disabled, only send trasactions to some of our servers. we were DOSing ourselves with transactions and slowing down sync +- [x] retry if we get "the method X is not available" - [-] let users choose a % of reverts to log (or maybe x/second). someone like curve logging all reverts will be a BIG database very quickly - this must be opt-in and spawned in the background since it will slow things down and will make their calls less private - [ ] automatic pruning of old revert logs once too many are collected diff --git a/web3_proxy/src/rpcs/connections.rs b/web3_proxy/src/rpcs/connections.rs index fef01b73..a6cd18a9 100644 --- a/web3_proxy/src/rpcs/connections.rs +++ b/web3_proxy/src/rpcs/connections.rs @@ -725,22 +725,34 @@ impl Web3Connections { } // some errors should be retried on other nodes - if error.code == -32000 { - let error_msg = error.message.as_str(); + match error.code { + -32000 => { + let error_msg = error.message.as_str(); - // TODO: regex? - let retry_prefixes = [ - "header not found", - "header for hash not found", - "missing trie node", - "node not started", - "RPC timeout", - ]; - for retry_prefix in retry_prefixes { - if error_msg.starts_with(retry_prefix) { + // TODO: regex? + let retry_prefixes = [ + "header not found", + "header for hash not found", + "missing trie node", + "node not started", + "RPC timeout", + ]; + for retry_prefix in retry_prefixes { + if error_msg.starts_with(retry_prefix) { + continue; + } + } + } + -32601 => { + let error_msg = error.message.as_str(); + + if error_msg.starts_with("the method") + && error_msg.ends_with("is not available") + { continue; } } + _ => {} } } else { // trace!(?response, "rpc success");