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

@@ -4,31 +4,18 @@
//! Supports Meshcore firmware on Heltec V3, T-Beam, RAK WisBlock, Station G2,
//! and other ESP32/nRF52-based LoRa boards via USB serial (Companion USB mode).
#[allow(dead_code)]
pub mod alerts;
#[allow(dead_code)]
pub mod bitcoin_relay;
#[allow(dead_code)]
pub mod crypto;
#[allow(dead_code)]
pub mod listener;
#[allow(dead_code)]
pub mod protocol;
#[allow(dead_code)]
pub mod serial;
#[allow(dead_code)]
pub mod types;
#[allow(dead_code)]
pub mod message_types;
#[allow(dead_code)]
pub mod outbox;
#[allow(dead_code)]
pub mod ratchet;
#[allow(dead_code)]
pub mod session;
#[allow(dead_code)]
pub mod steganography;
#[allow(dead_code)]
pub mod x3dh;
pub use types::*;
@@ -154,7 +141,6 @@ pub struct MeshService {
pub dead_man_switch: Arc<DeadManSwitch>,
}
#[allow(dead_code)]
impl MeshService {
/// Create a new MeshService. Does not start the listener yet.
pub async fn new(
@@ -623,7 +609,7 @@ async fn bitcoin_rpc_getblockcount(client: &reqwest::Client) -> Result<u64> {
let resp: BitcoinRpcResponse<u64> = tokio::time::timeout(
Duration::from_secs(10),
client
.post("http://127.0.0.1:8332/")
.post(crate::constants::BITCOIN_RPC_URL)
.basic_auth(&rpc_user, Some(&rpc_pass))
.json(&body)
.send()
@@ -652,7 +638,7 @@ async fn bitcoin_rpc_getblockheader_by_height(
let resp: BitcoinRpcResponse<String> = tokio::time::timeout(
Duration::from_secs(10),
client
.post("http://127.0.0.1:8332/")
.post(crate::constants::BITCOIN_RPC_URL)
.basic_auth(&rpc_user, Some(&rpc_pass))
.json(&body)
.send()
@@ -672,7 +658,7 @@ async fn bitcoin_rpc_getblockheader_by_height(
let resp: BitcoinRpcResponse<serde_json::Value> = tokio::time::timeout(
Duration::from_secs(10),
client
.post("http://127.0.0.1:8332/")
.post(crate::constants::BITCOIN_RPC_URL)
.basic_auth(&rpc_user, Some(&rpc_pass))
.json(&body)
.send()