Skip to content

Commit ba00bb7

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

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

async_substrate_interface/sync_substrate.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ def init_runtime(
741741
return
742742

743743
runtime = self.runtime_cache.retrieve(runtime_version=runtime_version)
744-
if not runtime or runtime.metadata is None:
744+
if not runtime:
745745
self.last_block_hash = block_hash
746746

747747
runtime_block_hash = self.get_parent_block_hash(block_hash)
@@ -751,6 +751,11 @@ def init_runtime(
751751
metadata = self.get_block_metadata(
752752
block_hash=runtime_block_hash, decode=True
753753
)
754+
if metadata is None:
755+
# does this ever happen?
756+
raise SubstrateRequestException(
757+
f"No metadata for block '{runtime_block_hash}'"
758+
)
754759
logger.debug(
755760
"Retrieved metadata for {} from Substrate node".format(
756761
runtime_version

0 commit comments

Comments
 (0)