Skip to content

Commit

Permalink
fix: use crossbeam channels
Browse files Browse the repository at this point in the history
  • Loading branch information
vabanaerytk authored and Ludo Galabru committed Aug 23, 2023
1 parent 47d2ef6 commit 50595ab
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/chainhook-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ redis = "0.21.5"
serde-redis = "0.12.0"
hex = "0.4.3"
rand = "0.8.5"
chainhook-sdk = { version = "0.8.2", default-features = false, features = ["zeromq"], path = "../chainhook-sdk" }
chainhook-sdk = { version = "0.8.4", default-features = false, features = ["zeromq"], path = "../chainhook-sdk" }
clarinet-files = "1.0.1"
hiro-system-kit = "0.1.0"
# clarinet-files = { path = "../../../clarinet/components/clarinet-files" }
Expand Down
4 changes: 2 additions & 2 deletions components/chainhook-sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chainhook-sdk"
version = "0.8.2"
version = "0.8.4"
description = "Stateless Transaction Indexing Engine for Stacks and Bitcoin"
license = "GPL-3.0"
edition = "2021"
Expand All @@ -18,7 +18,7 @@ hiro-system-kit = "0.1.0"
# stacks-rpc-client = { version = "1", path = "../../../clarinet/components/stacks-rpc-client" }
# clarinet-utils = { version = "1", path = "../../../clarinet/components/clarinet-utils" }
# hiro-system-kit = { version = "0.1.0", path = "../../../clarinet/components/hiro-system-kit" }
chainhook-types = { version = "1.0.11", path = "../chainhook-types-rs" }
chainhook-types = { version = "1.0.12", path = "../chainhook-types-rs" }
rocket = { version = "=0.5.0-rc.3", features = ["json"] }
bitcoincore-rpc = "0.16.0"
bitcoincore-rpc-json = "0.16.0"
Expand Down
9 changes: 5 additions & 4 deletions components/chainhook-sdk/src/observer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use rocket::config::{self, Config, LogLevel};
use rocket::data::{Limits, ToByteUnit};
use rocket::serde::Deserialize;
use rocket::Shutdown;
use std::collections::{BTreeMap, BTreeSet, HashMap, VecDeque};
use std::collections::{BTreeMap, BTreeSet, HashMap};
use std::error::Error;
use std::net::{IpAddr, Ipv4Addr};
use std::path::PathBuf;
Expand Down Expand Up @@ -344,10 +344,10 @@ pub struct BitcoinBlockDataCached {

pub struct ObserverSidecar {
pub bitcoin_blocks_mutator: Option<(
Sender<(Vec<BitcoinBlockDataCached>, Vec<BlockIdentifier>)>,
Receiver<Vec<BitcoinBlockDataCached>>,
crossbeam_channel::Sender<(Vec<BitcoinBlockDataCached>, Vec<BlockIdentifier>)>,
crossbeam_channel::Receiver<Vec<BitcoinBlockDataCached>>,
)>,
pub bitcoin_chain_event_notifier: Option<Sender<HandleBlock>>,
pub bitcoin_chain_event_notifier: Option<crossbeam_channel::Sender<HandleBlock>>,
}

impl ObserverSidecar {
Expand Down Expand Up @@ -662,6 +662,7 @@ pub fn start_zeromq_runloop(
#[cfg(feature = "zeromq")]
{
use crate::indexer::fork_scratch_pad::ForkScratchPad;
use std::collections::VecDeque;

if let BitcoinBlockSignaling::ZeroMQ(ref bitcoind_zmq_url) = config.bitcoin_block_signaling
{
Expand Down
4 changes: 2 additions & 2 deletions components/chainhook-sdk/src/observer/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1224,8 +1224,8 @@ fn test_bitcoin_chainhook_auto_deregister() {
#[test]
fn test_bitcoin_chainhook_through_reorg() {
let (observer_commands_tx, observer_commands_rx) = channel();
let (block_pre_processor_in_tx, block_pre_processor_in_rx) = channel();
let (block_pre_processor_out_tx, block_pre_processor_out_rx) = channel();
let (block_pre_processor_in_tx, block_pre_processor_in_rx) = crossbeam_channel::unbounded();
let (block_pre_processor_out_tx, block_pre_processor_out_rx) = crossbeam_channel::unbounded();

let (observer_events_tx, observer_events_rx) = crossbeam_channel::unbounded();
let observer_metrics_rw_lock = Arc::new(RwLock::new(ObserverMetrics::default()));
Expand Down
2 changes: 1 addition & 1 deletion components/chainhook-types-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "chainhook-types"
description = "Bitcoin and Stacks data schemas, based on the Rosetta specification"
license = "MIT"
version = "1.0.11"
version = "1.0.12"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down

0 comments on commit 50595ab

Please sign in to comment.