Skip to content

Commit cb9ad66

Browse files
author
µ
committed
async_substrate.py: in init_runtime(), don't allow metadata==None
1 parent ba00bb7 commit cb9ad66

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

async_substrate_interface/async_substrate.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ async def init_runtime(
996996
return
997997

998998
runtime = self.runtime_cache.retrieve(runtime_version=runtime_version)
999-
if not runtime or runtime.metadata is None:
999+
if not runtime:
10001000
self.last_block_hash = block_hash
10011001

10021002
runtime_block_hash = await self.get_parent_block_hash(block_hash)
@@ -1008,6 +1008,11 @@ async def init_runtime(
10081008
metadata = await self.get_block_metadata(
10091009
block_hash=runtime_block_hash, decode=True
10101010
)
1011+
if metadata is None:
1012+
# does this ever happen?
1013+
raise SubstrateRequestException(
1014+
f"No metadata for block '{runtime_block_hash}'"
1015+
)
10111016
logger.debug(
10121017
"Retrieved metadata for {} from Substrate node".format(
10131018
runtime_version

0 commit comments

Comments
 (0)