@@ -1104,8 +1104,8 @@ func SetNetworks(networkCfg config.NetworkConfig) ([]blockchain.EVMNetwork, erro
11041104 // if network is not simulated or forked, use the rpc urls and wallet keys from config
11051105 if ! strings .Contains (networkName , "SIMULATED" ) && ! forked {
11061106 var ok bool
1107-
1108- if ! networkCfg .ForceHttp {
1107+ // If we are forcinf htto but also have WSs available add them in case we need them
1108+ if ! networkCfg .ForceHttp || (networkCfg. RpcWsUrls [ selectedNetworks [ i ]] != nil && len (networkCfg. RpcWsUrls [ selectedNetworks [ i ]]) > 0 ) {
11091109 wsUrls , ok = networkCfg.RpcWsUrls [selectedNetworks [i ]]
11101110 if ! ok {
11111111 return nil , fmt .Errorf ("no rpc ws urls found in config for '%s' network" , selectedNetworks [i ])
@@ -1125,7 +1125,7 @@ func SetNetworks(networkCfg config.NetworkConfig) ([]blockchain.EVMNetwork, erro
11251125 // if evm_network config is found, use it
11261126 if networkCfg .EVMNetworks != nil {
11271127 if network , ok := networkCfg .EVMNetworks [networkName ]; ok && network != nil {
1128- if err := NewEVMNetwork (network , walletKeys , httpUrls , wsUrls , networkCfg . ForceHttp ); err != nil {
1128+ if err := NewEVMNetwork (network , walletKeys , httpUrls , wsUrls ); err != nil {
11291129 return nil , err
11301130 }
11311131 networks = append (networks , * network )
@@ -1134,7 +1134,7 @@ func SetNetworks(networkCfg config.NetworkConfig) ([]blockchain.EVMNetwork, erro
11341134 }
11351135 // if there is no evm_network config, use the known networks to find the network config from the map
11361136 if knownNetwork , valid := MappedNetworks [networkName ]; valid {
1137- err := NewEVMNetwork (& knownNetwork , walletKeys , httpUrls , wsUrls , networkCfg . ForceHttp )
1137+ err := NewEVMNetwork (& knownNetwork , walletKeys , httpUrls , wsUrls )
11381138 if err != nil {
11391139 return nil , err
11401140 }
@@ -1152,14 +1152,12 @@ func SetNetworks(networkCfg config.NetworkConfig) ([]blockchain.EVMNetwork, erro
11521152}
11531153
11541154// NewEVMNetwork sets the network's private key(s) and rpc urls
1155- func NewEVMNetwork (network * blockchain.EVMNetwork , walletKeys , httpUrls , wsUrls []string , forceHttp bool ) error {
1155+ func NewEVMNetwork (network * blockchain.EVMNetwork , walletKeys , httpUrls , wsUrls []string ) error {
11561156 if len (httpUrls ) > 0 {
11571157 network .HTTPURLs = httpUrls
11581158 }
1159- if ! forceHttp {
1160- if len (wsUrls ) > 0 {
1161- network .URLs = wsUrls
1162- }
1159+ if len (wsUrls ) > 0 {
1160+ network .URLs = wsUrls
11631161 }
11641162 if len (walletKeys ) > 0 {
11651163 if err := setKeys (network , walletKeys ); err != nil {
0 commit comments