This commit is contained in:
2026-01-19 20:03:17 -04:00
parent 4a592fa3ef
commit e78a1efb68
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 {