Skip to content

Commit

Permalink
when snapshots can't be found for version, just pick the most recent (#…
Browse files Browse the repository at this point in the history
…611)

* when snapshots can't be found for version, pick a random version

Right now there are no v18 snapshots on xtz-shots, so it's not possible
to kickstart a node. This PR will pick the v17 snapshot instead.

* fix black
  • Loading branch information
nicolasochem authored Nov 18, 2023
1 parent fa60fa2 commit 34e657d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion mkchain/tqchain/mkchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ def main():
for key_type in keys:
accounts[key_type][account] = {
"key": keys[key_type],
"is_bootstrap_baker_account": False if account == "authorized-key-0" else True,
"is_bootstrap_baker_account": False
if account == "authorized-key-0"
else True,
"bootstrap_balance": "4000000000000",
}

Expand Down
5 changes: 4 additions & 1 deletion utils/config-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,11 +762,14 @@ def create_node_snapshot_config_json(history_mode):
and s.get("chain_name") == network_name
]
if octez_version:
matching_snapshots = [
version_matching_snapshots = [
s
for s in matching_snapshots
if int(octez_version) == s.get("tezos_version").get("version").get("major")
]
if len(version_matching_snapshots):
# If we can't find snapshots of the right octez version, we just pick the most recent available.
matching_snapshots = version_matching_snapshots
matching_snapshots = sorted(matching_snapshots, key=lambda s: s.get("block_height"))

return matching_snapshots[-1] if len(matching_snapshots) else None
Expand Down

0 comments on commit 34e657d

Please sign in to comment.