This commit is contained in:
2026-01-19 20:03:17 -04:00
parent d5fe22cc14
commit fa98283df6
6 changed files with 42 additions and 41 deletions

View File

@@ -316,8 +316,10 @@ async fn send_stats_report(cfg: &MyConfig, bcinfo: GetBlockchainInfoResult) -> R
let client = rClient::new();
let url = format!("{}/ping",welist_url);
debug!("welist url: {}",url);
let chain=bcinfo.chain.to_string().to_lowercase();
let message = format!("{0}{1}{2}{3}{4}",cfg.url,chain,bcinfo.blocks,bcinfo.median_time,bcinfo.best_block_hash);
trace!("message to be sent: {}",message);
let sign = sign_message(cfg.ssl_key_path.as_str(),&message.as_str());
let response = client.post(url)
.header("User-Agent", format!("bal-pusher/{}",VERSION))
@@ -330,7 +332,11 @@ async fn send_stats_report(cfg: &MyConfig, bcinfo: GetBlockchainInfoResult) -> R
"last_block_hash": bcinfo.best_block_hash,
"signature": sign,
}))
.send().await?;
.send().await?;
if !response.status().is_success() {
warn!("Non-success response: {} {}", response.status(), response.status().canonical_reason().unwrap_or(""));
}
let body = &(response.text().await?);
info!("Report to welist({})\tSent: {}", welist_url,body);
}else {

View File

@@ -26,15 +26,10 @@ use log::{ info, error, trace, debug};
use serde_json;
use chrono::Utc;
#[path = "../db.rs"]
mod db;
use crate::db::{ create_database, get_next_address_index, insert_xpub, save_new_address, get_last_used_address_by_ip, execute_insert };
use bal_server::db::{ create_database, get_next_address_index, insert_xpub, save_new_address, get_last_used_address_by_ip, execute_insert };
use bal_server::xpub::new_address_from_xpub;
#[path = "../xpub.rs"]
mod xpub;
use crate::xpub::new_address_from_xpub;
const VERSION:&str="0.2.2";
const VERSION:&str=env!("CARGO_PKG_VERSION");
const NETWORKS : [&str; 4]= ["bitcoin","testnet","signet","regtest"];
#[derive(Debug, Clone,Serialize, Deserialize)]
struct NetConfig {