refactor: centralize constants, eliminate unwraps, remove dead code, resolve TODOs

- R13+R16: Replace .expect() with .context()? in main.rs and identity.rs
- R17+R18+R19: Fix unwrap() calls in helpers and js-engine
- R20+R21: Remove #[allow(dead_code)] annotations and delete truly dead code
- R22-R26: Create constants.rs module, replace 21 hardcoded values across 12 files
- R28+R29: LND/DWN timeouts already present — verified
- R30-R33: Remove TODO comments, implement marketplace payment check

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-21 01:54:35 +00:00
parent c3d4a7063b
commit 94f2de4a64
22 changed files with 113 additions and 104 deletions

View File

@@ -0,0 +1,19 @@
/// Centralized constants for the Archipelago backend.
/// Avoids hardcoded values scattered across the codebase.
/// Bitcoin Core RPC endpoint (localhost only).
pub const BITCOIN_RPC_URL: &str = "http://127.0.0.1:8332/";
/// DWN (Decentralized Web Node) health check endpoint.
pub const DWN_HEALTH_URL: &str = "http://127.0.0.1:3100/health";
/// Tor SOCKS5 proxy for outbound onion connections.
pub const TOR_SOCKS_PROXY: &str = "socks5h://127.0.0.1:9050";
/// DNS-over-HTTPS providers for secure DNS resolution.
pub const DNS_PROVIDERS: &[&str] = &[
"https://cloudflare-dns.com/dns-query",
"https://dns.google/dns-query",
"https://dns.quad9.net/dns-query",
"https://dns.mullvad.net/dns-query",
];