Skip to content

Commit 974d789

Browse files
committed
zmq always accept a notifier
1 parent 7587165 commit 974d789

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

src/bin/electrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn run_server(config: Arc<Config>) -> Result<()> {
4646
metrics.start();
4747

4848
if let Some(zmq_addr) = config.zmq_addr.as_ref() {
49-
zmq::start(&format!("tcp://{zmq_addr}"), Some(block_hash_notify));
49+
zmq::start(&format!("tcp://{zmq_addr}"), block_hash_notify);
5050
}
5151

5252
let daemon = Arc::new(Daemon::new(

src/new_index/zmq.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crossbeam_channel::Sender;
33

44
use crate::util::spawn_thread;
55

6-
pub fn start(url: &str, block_hash_notify: Option<Sender<BlockHash>>) {
6+
pub fn start(url: &str, block_hash_notify: Sender<BlockHash>) {
77
log::debug!("Starting ZMQ thread");
88
let ctx = zmq::Context::new();
99
let subscriber: zmq::Socket = ctx.socket(zmq::SUB).expect("failed creating subscriber");
@@ -28,9 +28,7 @@ pub fn start(url: &str, block_hash_notify: Option<Sender<BlockHash>>) {
2828
reversed.reverse();
2929
if let Ok(block_hash) = BlockHash::from_slice(&reversed[..]) {
3030
log::debug!("New block from ZMQ: {block_hash}");
31-
if let Some(block_hash_notify) = block_hash_notify.as_ref() {
32-
let _ = block_hash_notify.send(block_hash);
33-
}
31+
let _ = block_hash_notify.send(block_hash);
3432
}
3533
}
3634
}

0 commit comments

Comments
 (0)