bnb-chain / opbnb

MIT License
403 stars 163 forks source link

fix(op-service): fallback client failed to switch URL in txmgr #232

Closed welkin22 closed 2 months ago

welkin22 commented 2 months ago

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() in clientInitFunc to ensure a successful connection to the next URL.

Example

none

Changes

Notable changes: