Skip to content

Commit

Permalink
Showing 3 changed files with 310 additions and 52 deletions.
342 changes: 290 additions & 52 deletions Cargo.lock
1 change: 1 addition & 0 deletions components/chainhook-event-observer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -50,6 +50,7 @@ threadpool = "1.8.1"
rand = "0.8.5"
hex-simd = "0.8.0"
serde_cbor = "0.11.2"
zeromq = { version = "*", default-features = false, features = ["tokio-runtime", "tcp-transport"] }

[replace]
"jsonrpc:0.13.0" = { git = 'https://github.com/apoelstra/rust-jsonrpc', rev = "1063671f122a8985c1b7c29030071253da515839" }
19 changes: 19 additions & 0 deletions components/chainhook-event-observer/src/observer/mod.rs
Original file line number Diff line number Diff line change
@@ -409,6 +409,15 @@ pub async fn start_event_observer(
let _ = hiro_system_kit::nestable_block_on(ignite.launch());
});

if let BitcoinBlockSignaling::ZeroMQ(ref bitcoind_zmq_url) = config.bitcoin_block_signaling {
let bitcoind_zmq_endpoint = bitcoind_zmq_url.parse::<zeromq::Endpoint>()?;
hiro_system_kit::thread_named("Bitcoind zmq listener")
.spawn(move || {
// bitcoind_zmq_endpoint
})
.expect("unable to spawn thread");
}

// This loop is used for handling background jobs, emitted by HTTP calls.
start_observer_commands_handler(
config,
@@ -1187,6 +1196,16 @@ pub async fn handle_new_bitcoin_block(
background_job_tx: &State<Arc<Mutex<Sender<ObserverCommand>>>>,
ctx: &State<Context>,
) -> Json<JsonValue> {
if bitcoin_config
.bitcoin_block_signaling
.should_ignore_bitcoin_block_signaling_through_stacks()
{
return Json(json!({
"status": 200,
"result": "Ok",
}));
}

ctx.try_log(|logger| slog::info!(logger, "POST /new_burn_block"));
// Standardize the structure of the block, and identify the
// kind of update that this new block would imply, taking

0 comments on commit 0ec2653

Please sign in to comment.