scan at each new block

This commit is contained in:
Sosthene 2024-06-25 11:23:15 +02:00 committed by Nicolas Cantu
parent 0647e255f9
commit e8ccf9ba93

View File

@ -235,7 +235,7 @@ async fn handle_zmq(zmq_url: String, electrum_url: String) {
let mut socket = zeromq::SubSocket::new();
socket.connect(&zmq_url).await.unwrap();
socket.subscribe("rawtx").await.unwrap();
// socket.subscribe("hashblock");
socket.subscribe("hashblock").await.unwrap();
loop {
let core_msg = match socket.recv().await {
Ok(m) => m,
@ -260,7 +260,13 @@ async fn handle_zmq(zmq_url: String, electrum_url: String) {
continue;
}
},
Ok("hashblock") => todo!(),
Ok("hashblock") => match scan_blocks(0, &electrum_url) {
Ok(_) => continue,
Err(e) => {
error!("{}", e);
continue;
}
},
_ => {
error!("Unexpected message in zmq");
continue;