When initializing txmgr, the context passed to DialEthClientWithTimeoutAndFallback is one that will be immediately closed, which I did not notice. When a switch occurs, the fallback client uses the already closed context to establish a connection with the next URL, causing the switch to fail.
Rationale
Modify the code to use context.Background() in clientInitFunc to ensure a successful connection to the next URL.
Example
none
Changes
Notable changes:
Modified the logic in DialEthClientWithTimeoutAndFallback
Description
When initializing txmgr, the context passed to DialEthClientWithTimeoutAndFallback is one that will be immediately closed, which I did not notice. When a switch occurs, the fallback client uses the already closed context to establish a connection with the next URL, causing the switch to fail.
Rationale
Modify the code to use
context.Background()
inclientInitFunc
to ensure a successful connection to the next URL.Example
none
Changes
Notable changes: