Skip to content

Commit 9472a1a

Browse files
author
µ
committed
sync_substrate.py: drop _first_init_runtime()
1 parent c5d342a commit 9472a1a

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

async_substrate_interface/sync_substrate.py

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ def initialize(self):
535535
if not self._chain:
536536
chain = self.rpc_request("system_chain", [])
537537
self._chain = chain.get("result")
538-
self._first_initialize_runtime()
538+
self.init_runtime()
539539
self.initialized = True
540540

541541
def __exit__(self, exc_type, exc_val, exc_tb):
@@ -644,26 +644,6 @@ def decode_scale(
644644
else:
645645
return obj
646646

647-
def _first_initialize_runtime(self):
648-
"""
649-
TODO docstring
650-
"""
651-
metadata_v15 = self._load_registry_at_block(None)
652-
self.load_runtime(
653-
runtime_info = self.get_block_runtime_info(None),
654-
metadata = self.get_block_metadata(),
655-
metadata_v15 = metadata_v15,
656-
registry = self.registry,
657-
)
658-
659-
# Check and apply runtime constants
660-
ss58_prefix_constant = self.get_constant(
661-
"System", "SS58Prefix"
662-
)
663-
664-
if ss58_prefix_constant:
665-
self.ss58_format = ss58_prefix_constant
666-
667647
def load_runtime(self,runtime_info=None,metadata=None,metadata_v15=None,registry=None):
668648
# Update type registry
669649
self.reload_type_registry(use_remote_preset=False, auto_discover=True)
@@ -774,6 +754,15 @@ def init_runtime(
774754
registry=runtime.registry,
775755
)
776756

757+
if self.ss58_format is None:
758+
# Check and apply runtime constants
759+
ss58_prefix_constant = self.get_constant(
760+
"System", "SS58Prefix", block_hash=block_hash
761+
)
762+
763+
if ss58_prefix_constant:
764+
self.ss58_format = ss58_prefix_constant
765+
777766
def create_storage_key(
778767
self,
779768
pallet: str,

0 commit comments

Comments
 (0)