File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -285,12 +285,23 @@ impl BlockStore {
285285 shard,
286286 ) ;
287287 }
288+ // If the chain's shard has no pool (e.g. pool_size = 0), treat it as a
289+ // misconfiguration and panic with an actionable message.
290+ if !block_store. pools . contains_key ( & chain. shard ) {
291+ panic ! (
292+ "chain '{0}' is configured for shard '{1}' which has no connection pool on this node; \
293+ set pool_size > 0 for shard '{1}' or remove the chain from the config",
294+ chain. name, chain. shard,
295+ ) ;
296+ }
297+
288298 block_store. add_chain_store ( chain, false ) . await ?;
289299 } ;
290300 }
291301
292302 // There might be chains we have in the database that are not yet/
293- // no longer configured. Add a chain store for each of them, too
303+ // no longer configured. Add a chain store for each of them, too.
304+ // Ignore chains that are in the database, but have no pools for their shards.
294305 let configured_chains = block_store
295306 . stores
296307 . read ( )
@@ -301,6 +312,16 @@ impl BlockStore {
301312 . iter ( )
302313 . filter ( |chain| !configured_chains. contains ( & chain. name ) )
303314 {
315+ if !block_store. pools . contains_key ( & chain. shard ) {
316+ warn ! (
317+ & block_store. logger,
318+ "Chain `{}` is stored in shard `{}` which has no connection pool on this node, skipping" ,
319+ chain. name,
320+ chain. shard,
321+ ) ;
322+ continue ;
323+ }
324+
304325 block_store. add_chain_store ( chain, false ) . await ?;
305326 }
306327 Ok ( block_store)
You can’t perform that action at this time.
0 commit comments