|
6 | 6 |
|
7 | 7 | from bittensor_wallet.keypair import Keypair |
8 | 8 | from bittensor_wallet.utils import SS58_FORMAT |
9 | | -from bt_decode import ( |
10 | | - MetadataV15, |
11 | | - PortableRegistry, |
12 | | - decode as decode_by_type_string, |
13 | | - AxonInfo as OldAxonInfo, |
14 | | - PrometheusInfo as OldPrometheusInfo, |
15 | | -) |
| 9 | +from bt_decode import MetadataV15, PortableRegistry, decode as decode_by_type_string |
16 | 10 | from scalecodec import ( |
17 | 11 | GenericCall, |
18 | 12 | GenericExtrinsic, |
@@ -701,7 +695,10 @@ def get_runtime(block_hash, block_id) -> Runtime: |
701 | 695 | if ( |
702 | 696 | (block_hash and block_hash == self.last_block_hash) |
703 | 697 | or (block_id and block_id == self.block_id) |
704 | | - ) and self._metadata is not None: |
| 698 | + ) and all( |
| 699 | + x is not None |
| 700 | + for x in [self._metadata, self._old_metadata_v15, self.metadata_v15] |
| 701 | + ): |
705 | 702 | return Runtime( |
706 | 703 | self.chain, |
707 | 704 | self.runtime_config, |
@@ -743,9 +740,9 @@ def get_runtime(block_hash, block_id) -> Runtime: |
743 | 740 | f"No runtime information for block '{block_hash}'" |
744 | 741 | ) |
745 | 742 | # Check if runtime state already set to current block |
746 | | - if ( |
747 | | - runtime_info.get("specVersion") == self.runtime_version |
748 | | - and self._metadata is not None |
| 743 | + if runtime_info.get("specVersion") == self.runtime_version and all( |
| 744 | + x is not None |
| 745 | + for x in [self._metadata, self._old_metadata_v15, self.metadata_v15] |
749 | 746 | ): |
750 | 747 | return Runtime( |
751 | 748 | self.chain, |
@@ -802,7 +799,6 @@ def get_runtime(block_hash, block_id) -> Runtime: |
802 | 799 | self.runtime_version |
803 | 800 | ) |
804 | 801 | ) |
805 | | - |
806 | 802 | # Update metadata v15 cache |
807 | 803 | self._metadata_v15_cache[self.runtime_version] = metadata_v15 |
808 | 804 |
|
|
0 commit comments