Skip to content

Commit

Permalink
Merge branch 'main' into update_qtum_db
Browse files Browse the repository at this point in the history
  • Loading branch information
qtum-neil authored Sep 28, 2023
2 parents 976654a + c6960f3 commit 7ff5df8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
6 changes: 6 additions & 0 deletions app-load-params-db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,12 @@
"curve": ["secp256k1"],
"path": ["44'/195'"]
},
"trustchain": {
"appFlags": {"nanos": "0x000", "nanos2": "0x000", "nanox": "0x200", "stax": "0x200"},
"appName": "Trustchain",
"curve": ["secp256k1"],
"path": ["99'/99''"]
},
"ubiq": {
"appFlags": {"nanos": "0xa40", "nanos2": "0xa40", "nanox": "0xa40"},
"appName": "Ubiq",
Expand Down
13 changes: 7 additions & 6 deletions scripts/app_load_params_lint.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python3

import json
import difflib
from argparse import ArgumentParser
from pathlib import Path
from app_load_params_utils import format_database
from app_load_params_check import APP_LOAD_PARAMS_VALUE_CHECK
import json
import difflib


def check_database_lint(database_path: Path):
Expand All @@ -15,7 +15,7 @@ def check_database_lint(database_path: Path):
database = json.loads(database_str)

for variant, params in database.items():
for param, value in params.items():
for param, _ in params.items():
if param not in APP_LOAD_PARAMS_VALUE_CHECK:
print(f"[ERROR] Not allowed '{param}' in variant '{variant}'")
ret = -1
Expand All @@ -40,13 +40,14 @@ def check_database_appnames(database_path: Path):
database_str = f.read()
database = json.loads(database_str)

db_rev = {v["appName"]: k for k, v in database.items()}
db_rev = {v["appName"].lower().replace(" ","").replace("_", "").replace("-", ""): k for k,
v in database.items()}

for variant, params in database.items():
app_name = params["appName"]
db_rev_variant = db_rev[app_name]
db_rev_variant = db_rev[app_name.lower().replace(" ","").replace("_", "").replace("-", "")]
if db_rev_variant != variant:
print(f"[ERROR] Conflict on appName between '{db_rev_variant}' and '{variant}'")
print(f"[ERROR] Conflict on appName between '{db_rev_variant}' and '{variant}'. AppName shall be unique ('-',' ' and '_' are stripped)")
ret = -1

if ret != 0:
Expand Down

0 comments on commit 7ff5df8

Please sign in to comment.