B5: real deposits on the ORM, Electrum scan with quorum and merkle proof, configurable threshold (DEP-20..23, ELC-31)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
davideandClaude Sonnet 5.5 committed 2026-11-16 16:09:36 +01:00
1 parent f1d09075a1
commit 2acd4ccd1c
21 files changed
+1223 -49

No files matched your search

+22
View File
@@ -169,6 +169,28 @@ PLM_PROFILE = network_profile(PLM_NETWORK)
# ARC-78: the web process knows only the public account key; the signing key is the worker's alone.
PROCESS_ROLE = os.environ.get("PROCESS_ROLE", "web")
PLM_ACCOUNT_XPUB = os.environ.get("PLM_ACCOUNT_XPUB", "")
# ELC-31: the Electrum servers of a real ledger, first = preferred. Rotation and quorum need at least three;
# ELECTRUM_ALLOW_NO_QUORUM relaxes that for development only, never on mainnet.
ELECTRUM_SERVERS = os.environ.get("ELECTRUM_SERVERS", "")
ELECTRUM_ALLOW_NO_QUORUM = os.environ.get("ELECTRUM_ALLOW_NO_QUORUM", "").lower() == "true"
if ELECTRUM_ALLOW_NO_QUORUM and PLM_NETWORK == "mainnet":
raise ImproperlyConfigured("ELECTRUM_ALLOW_NO_QUORUM is for development: it cannot be set on mainnet (ELC-31)")
if LEDGER_BACKEND == "chain":
from plm_engine.electrum.client import parse_server_list
try:
ELECTRUM_ENDPOINTS = parse_server_list(ELECTRUM_SERVERS)
except ValueError as error:
raise ImproperlyConfigured(f"ELECTRUM_SERVERS: {error}") from error
if not ELECTRUM_ENDPOINTS:
raise ImproperlyConfigured("LEDGER_BACKEND=chain needs ELECTRUM_SERVERS (ELC-31)")
if len(ELECTRUM_ENDPOINTS) < 3 and not ELECTRUM_ALLOW_NO_QUORUM:
raise ImproperlyConfigured(
"ELECTRUM_SERVERS needs at least three servers for a quorum (ELC-31); ELECTRUM_ALLOW_NO_QUORUM=true is development only"
)
else:
ELECTRUM_ENDPOINTS = []
PLM_MASTER_KEY_FILE = os.environ.get("PLM_MASTER_KEY_FILE", "")
PLM_KEY_ENCRYPTION_KEY_FILE = os.environ.get("PLM_KEY_ENCRYPTION_KEY_FILE", "")