Skip to content

Commit

Permalink
force using websocket rpc provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaiba committed Feb 20, 2025
1 parent b0ee050 commit 7a97e74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
9 changes: 3 additions & 6 deletions node/exts/erc20-bridge/signersvc/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,9 @@ func NewServiceMgr(
return nil, fmt.Errorf("chain %s not found in rpc config", chain)
}

// we need http endpoint
if strings.HasPrefix(chainRpc, "wss://") {
chainRpc = strings.Replace(chainRpc, "wss://", "https://", 1)
}
if strings.HasPrefix(chainRpc, "ws") {
chainRpc = strings.Replace(chainRpc, "ws://", "http://", 1)
// we need websocket endpoint
if !strings.HasPrefix(chainRpc, "wss://") && !strings.HasPrefix(chainRpc, "ws://") {
return nil, fmt.Errorf("chain %s rpc must start with wss:// or ws://", chain)
}

if !strings.Contains(value, signerCfgDelimiter) {
Expand Down
7 changes: 2 additions & 5 deletions node/exts/evm-sync/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,8 @@ func getChainConf(cfg config.ERC20BridgeConfig, chain chains.Chain) (*chainConfi
}

// we need websocket endpoint
if strings.HasPrefix(provider, "https://") {
provider = strings.Replace(provider, "https://", "wss://", 1)
}
if strings.HasPrefix(provider, "http://") {
provider = strings.Replace(provider, "http://", "ws://", 1)
if !strings.HasPrefix(provider, "wss://") && !strings.HasPrefix(provider, "ws://") {
return nil, fmt.Errorf("chain %s rpc must start with wss:// or ws://", chain)
}

syncChunk, ok = cfg.BlockSyncChuckSize[chains.Ethereum.String()]
Expand Down

0 comments on commit 7a97e74

Please sign in to comment.