Faucet: treat connection-level failures (socket hang up, EPIPE, fetch failed, ...) as transient: leave the drip due and rotate RPC instead of marking it failed (PolHunter #7, 2026-10-09)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-09 04:30:19 -05:00
parent 307a2e41c2
commit c8da4e1684
+1 -1
View File
@@ -60,7 +60,7 @@ function bridge(action, method, body) {
// ---- chain // ---- chain
let provider = null, wallet = null, rpcAt = 0; let provider = null, wallet = null, rpcAt = 0;
function connect() { provider = new ethers.JsonRpcProvider(RPCS[rpcAt % RPCS.length], CHAIN_ID); wallet = new ethers.Wallet(KEY, provider); } function connect() { provider = new ethers.JsonRpcProvider(RPCS[rpcAt % RPCS.length], CHAIN_ID); wallet = new ethers.Wallet(KEY, provider); }
const TRANSIENT = /server response 5\d\d|timeout|ETIMEDOUT|ECONNRESET|ECONNREFUSED|EAI_AGAIN|429|rate limit|missing response|could not detect network|bad response|SERVER_ERROR|NETWORK_ERROR/i; const TRANSIENT = /socket hang up|ECONNABORTED|EPIPE|EHOSTUNREACH|ENETUNREACH|network error|fetch failed|UND_ERR|other side closed|server response 5\d\d|timeout|ETIMEDOUT|ECONNRESET|ECONNREFUSED|EAI_AGAIN|429|rate limit|missing response|could not detect network|bad response|SERVER_ERROR|NETWORK_ERROR/i; // + connection-level failures (PolHunter #7, 2026-10-09)
function rotate(why) { if (RPCS.length > 1) { rpcAt = (rpcAt + 1) % RPCS.length; connect(); log('rpc rotated after', why.slice(0, 80)); } } function rotate(why) { if (RPCS.length > 1) { rpcAt = (rpcAt + 1) % RPCS.length; connect(); log('rpc rotated after', why.slice(0, 80)); } }
async function balance() { return Number(ethers.formatEther(await provider.getBalance(wallet.address))); } async function balance() { return Number(ethers.formatEther(await provider.getBalance(wallet.address))); }