secrets fix
This commit is contained in:
parent
7d920907cc
commit
45374987e7
|
|
@ -66,33 +66,33 @@ def _init_seed_via_db() -> bytes:
|
|||
except Exception:
|
||||
return None
|
||||
|
||||
seed = read_seed()
|
||||
if seed:
|
||||
return seed
|
||||
seed = read_seed()
|
||||
if seed:
|
||||
return seed
|
||||
|
||||
if role == "primary":
|
||||
seed = _load_seed_from_env_or_generate()
|
||||
# Try insert; if another primary raced, ignore
|
||||
try:
|
||||
with engine.connect() as wconn:
|
||||
with Session(bind=wconn) as s:
|
||||
s.add(ServiceConfigValue(key='private_key', packed_value={"value": seed.hex()}))
|
||||
s.commit()
|
||||
make_log("HotWallet", "Seed saved in service_config by primary", level='info')
|
||||
if role == "primary":
|
||||
seed = _load_seed_from_env_or_generate()
|
||||
# Try insert; if another primary raced, ignore
|
||||
try:
|
||||
with engine.connect() as wconn:
|
||||
with Session(bind=wconn) as s:
|
||||
s.add(ServiceConfigValue(key='private_key', packed_value={"value": seed.hex()}))
|
||||
s.commit()
|
||||
make_log("HotWallet", "Seed saved in service_config by primary", level='info')
|
||||
return seed
|
||||
except Exception:
|
||||
# Read again in case of race
|
||||
seed2 = read_seed()
|
||||
if seed2:
|
||||
return seed2
|
||||
raise
|
||||
else:
|
||||
make_log("HotWallet", "Worker waiting for seed in service_config...", level='info')
|
||||
while True:
|
||||
seed = read_seed()
|
||||
if seed:
|
||||
return seed
|
||||
except Exception:
|
||||
# Read again in case of race
|
||||
seed2 = read_seed()
|
||||
if seed2:
|
||||
return seed2
|
||||
raise
|
||||
else:
|
||||
make_log("HotWallet", "Worker waiting for seed in service_config...", level='info')
|
||||
while True:
|
||||
seed = read_seed()
|
||||
if seed:
|
||||
return seed
|
||||
time.sleep(0.5)
|
||||
time.sleep(0.5)
|
||||
|
||||
|
||||
_extra_ton_wallet_options = {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue