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:
co-authored by
Claude Opus 4.6
parent
5c3a3ffa8e
commit
f3976ba03a
@@ -1,7 +1,7 @@
|
||||
// Archipelago Bitcoin Node OS - Native Backend
|
||||
// Pure Archipelago implementation, no StartOS dependencies
|
||||
|
||||
use anyhow::Result;
|
||||
use anyhow::{Context, Result};
|
||||
use std::net::SocketAddr;
|
||||
use tracing::info;
|
||||
use tokio::signal;
|
||||
@@ -9,6 +9,7 @@ use tokio::signal;
|
||||
mod api;
|
||||
mod auth;
|
||||
mod backup;
|
||||
mod constants;
|
||||
mod bitcoin_rpc;
|
||||
mod config;
|
||||
mod content_server;
|
||||
@@ -122,7 +123,7 @@ async fn main() -> Result<()> {
|
||||
// Start server
|
||||
let addr: SocketAddr = format!("{}:{}", config.bind_host, config.bind_port)
|
||||
.parse()
|
||||
.expect("Invalid bind address");
|
||||
.context("Invalid bind address")?;
|
||||
|
||||
// Spawn background update scheduler
|
||||
let update_data_dir = config.data_dir.clone();
|
||||
@@ -155,9 +156,9 @@ async fn main() -> Result<()> {
|
||||
});
|
||||
|
||||
// Graceful shutdown: wait for SIGTERM or SIGINT
|
||||
let shutdown = async {
|
||||
let mut sigterm = signal::unix::signal(signal::unix::SignalKind::terminate())
|
||||
.expect("Failed to register SIGTERM handler");
|
||||
let mut sigterm = signal::unix::signal(signal::unix::SignalKind::terminate())
|
||||
.context("Failed to register SIGTERM handler")?;
|
||||
let shutdown = async move {
|
||||
tokio::select! {
|
||||
_ = signal::ctrl_c() => {
|
||||
info!("Received SIGINT (Ctrl+C), initiating graceful shutdown...");
|
||||
|
||||
Reference in New Issue
Block a user