fix: bug fixes, dead code removal, improved ZMQ logging

- Fix SQL syntax error in create_database (trailing parenthesis)
- Fix typo i27.0.0.1 -> 127.0.0.1 in Testnet/Testnet4 defaults
- Replace hardcoded VERSION with CARGO_PKG_VERSION in bal-pusher
- Remove unwrap() in DB update loops (status push/invalid)
- Remove duplicate init_network call in bal-server startup
- Use INSERT OR IGNORE for idempotent xpub initialization
- Remove debug println! left in production code
- Remove dead code: check_zmq_connection, ConnectionMonitor, seq_to_str
- Remove all commented-out code blocks
- ZMQ timeout logging: trace instead of warn, error only after 1 hour
This commit is contained in:
2026-07-20 08:48:54 -04:00
parent ca530bf987
commit 36219c49a0
3 changed files with 48 additions and 194 deletions

View File

@@ -118,7 +118,7 @@ pub struct StatsResponse {
}
#[derive(Debug, Clone)]
#[allow(dead_code)]
#[expect(dead_code)]
struct ActixConfig {
max_body_size: usize,
timeout_secs: u64,
@@ -413,13 +413,8 @@ async fn echo_stats(path: web::Path<String>, data: web::Data<AppState>) -> impl
unique_inputs,
});
}
match serde_json::to_string(&stats) {
Ok(json_data) => {
debug!("echo info reply: {}", json_data);
HttpResponse::Ok().json(stats)
}
Err(_err) => HttpResponse::InternalServerError().body("error"),
}
debug!("echo stats reply for chain: {}", netconfig.name);
HttpResponse::Ok().json(stats)
}
async fn echo_search(body: Bytes, data: web::Data<AppState>) -> impl Responder {
@@ -531,7 +526,6 @@ fn parse_request_transactions(
known_addresses: &HashSet<String>,
) -> Vec<(ParsedTx, String, u64)> {
let mut result: Vec<(ParsedTx, String, u64)> = Vec::new();
let mut union_tx = true;
for line in strbody.split('\n') {
if line.is_empty() {
@@ -615,11 +609,6 @@ fn parse_request_transactions(
trace!("willexecutor output not found for tx {}, skipping", txid);
continue;
}
if !union_tx {
// This is only used for SQL building later; we track it in the caller
} else {
union_tx = false;
}
result.push((
ParsedTx {
txid,
@@ -911,15 +900,6 @@ async fn main() -> std::io::Result<()> {
cfg: cfg.clone(),
});
// Initialize networks
{
let db = data.db.lock().unwrap();
for network in NETWORKS {
let netconfig = data.cfg.get_net_config(network);
insert_xpub(&db, &netconfig.name.to_string(), &netconfig.address);
}
}
let bind_address = data.cfg.bind_address.clone();
let bind_port = data.cfg.bind_port;