Question related to FallbackProvider #2378
-
Hi there, I want to send one transaction to multiple nodes at the same time to have a higher chance to get my transaction mined fast. My understanding is that FallbackProvider is just right for the job. Please see my code below. Is this the right way or is there a better way to archive what I want to do? let provider1=new ethers.providers.WebSocketProvider(url[0])
let provider2=new ethers.providers.WebSocketProvider(url[1])
let provider3=new ethers.providers.WebSocketProvider(url[2])
let fallbackProvider=new ethers.providers.FallbackProvider([
{provider: provider1, priority: 1, weight: 1, stallTimeout: 0}
{provider: provider2, priority: 1, weight: 1, stallTimeout: 0}
{provider: provider2, priority: 1, weight: 1, stallTimeout: 0}
] , 1) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
You could also just pass the three providers into the FallbackProvider and it will create the config for you; the stallTimeout is ignored for sendTransaction. :) |
Beta Was this translation helpful? Give feedback.
-
Cheers @ricmoo |
Beta Was this translation helpful? Give feedback.
-
Hi @ricmoo, sorry to bother you again, but when I call a method like getBalance() the response will not return until all nodes responded, even if the stallTimeout is set to 0. Is this the desired behavior? |
Beta Was this translation helpful? Give feedback.
You could also just pass the three providers into the FallbackProvider and it will create the config for you; the stallTimeout is ignored for sendTransaction. :)