Fix wallet handler to use importlib for decrypt_private_key
Some checks failed
CLI Tests / test-cli (push) Failing after 3s
Security Scanning / security-scan (push) Successful in 33s
P2P Network Verification / p2p-verification (push) Successful in 2s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 2s

This commit is contained in:
aitbc
2026-04-28 17:57:59 +02:00
parent 2d73f51452
commit cac4c65aab

View File

@@ -113,7 +113,10 @@ def handle_wallet_send(args, send_transaction, read_password, first):
# Decrypt private key for signing
try:
sys.path.insert(0, "/opt/aitbc/cli")
import aitbc_cli as aitbc_cli_module
import importlib.util
spec = importlib.util.spec_from_file_location('aitbc_cli_module', '/opt/aitbc/cli/aitbc_cli.py')
aitbc_cli_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(aitbc_cli_module)
private_key_hex = aitbc_cli_module.decrypt_private_key(sender_keystore, password)
private_key = ed25519.Ed25519PrivateKey.from_private_bytes(bytes.fromhex(private_key_hex))
except Exception as e: