Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 12 additions & 84 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fallible-iterator = "0.3.0"
futures = { version = "0.3.30", default-features = false }
governor = { version = "0.8.1", default-features = false }
hashlink = "0.10.0"
heed = "0.21.0"
heed = "0.22.0"
hex = "0.4.3"
http = "1.2.0"
human-size = "0.4.3"
Expand All @@ -60,7 +60,7 @@ serde_json = "1.0.113"
serde_with = "3.4.0"
shlex = "1.3.0"
smallvec = "1.13.2"
sneed = "0.0.11"
sneed = "0.0.22"
strum = { version = "0.27.2", features = ["derive"] }
temp-dir = "0.2.0"
thiserror = "2.0.11"
Expand Down
2 changes: 1 addition & 1 deletion lib/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ pub struct Archive {
impl Archive {
pub const NUM_DBS: u32 = 15;

pub fn new(env: &sneed::Env) -> Result<Self, Error> {
pub fn new<Tls>(env: &sneed::Env<Tls>) -> Result<Self, Error> {
let mut rwtxn = env.write_txn().map_err(EnvError::from)?;
let version =
DatabaseUnique::create(env, &mut rwtxn, "archive_version")
Expand Down
2 changes: 1 addition & 1 deletion lib/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub struct MemPool {
impl MemPool {
pub const NUM_DBS: u32 = 3;

pub fn new(env: &sneed::Env) -> Result<Self, Error> {
pub fn new<Tls>(env: &sneed::Env<Tls>) -> Result<Self, Error> {
let mut rwtxn = env.write_txn().map_err(EnvError::from)?;
let transactions =
DatabaseUnique::create(env, &mut rwtxn, "transactions")
Expand Down
6 changes: 3 additions & 3 deletions lib/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ impl Net {
#[instrument(skip_all, fields(addr), err(Debug))]
pub fn connect_peer(
&self,
env: sneed::Env,
env: sneed::Env<heed::WithoutTls>,
addr: SocketAddr,
) -> Result<(), Error> {
if self.active_peers.read().contains_key(&addr) {
Expand Down Expand Up @@ -329,7 +329,7 @@ impl Net {
}

pub fn new(
env: &sneed::Env,
env: &sneed::Env<heed::WithoutTls>,
archive: Archive,
network: Network,
state: State,
Expand Down Expand Up @@ -412,7 +412,7 @@ impl Net {
/// and a new peer was added.
pub async fn accept_incoming(
&self,
env: sneed::Env,
env: sneed::Env<heed::WithoutTls>,
) -> Result<Option<SocketAddr>, error::AcceptConnection> {
tracing::debug!(
"accept incoming: listening for connections on `{}`",
Expand Down
2 changes: 1 addition & 1 deletion lib/net/peer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ impl Connection {
}

pub struct ConnectionContext {
pub env: sneed::Env,
pub env: sneed::Env<heed::WithoutTls>,
pub archive: Archive,
pub network: Network,
pub state: State,
Expand Down
6 changes: 3 additions & 3 deletions lib/node/mainchain_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ enum Error {
}

struct MainchainTask<Transport = tonic::transport::Channel> {
env: sneed::Env,
env: sneed::Env<heed::WithoutTls>,
archive: Archive,
mainchain: proto::mainchain::ValidatorClient<Transport>,
// receive a request, and optional oneshot sender to send the result to
Expand All @@ -88,7 +88,7 @@ where
/// including the specified header.
/// Returns `false` if the specified block was not available.
async fn request_ancestor_infos(
env: &sneed::Env,
env: &sneed::Env<heed::WithoutTls>,
archive: &Archive,
cusf_mainchain: &mut proto::mainchain::ValidatorClient<Transport>,
block_hash: bitcoin::BlockHash,
Expand Down Expand Up @@ -213,7 +213,7 @@ pub(super) struct MainchainTaskHandle {

impl MainchainTaskHandle {
pub fn new<Transport>(
env: sneed::Env,
env: sneed::Env<heed::WithoutTls>,
archive: Archive,
mainchain: mainchain::ValidatorClient<Transport>,
) -> (Self, mpsc::UnboundedReceiver<Response>)
Expand Down
10 changes: 5 additions & 5 deletions lib/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub struct Node<MainchainTransport = Channel> {
cusf_mainchain: Arc<Mutex<mainchain::ValidatorClient<MainchainTransport>>>,
cusf_mainchain_wallet:
Option<Arc<Mutex<mainchain::WalletClient<MainchainTransport>>>>,
env: sneed::Env,
env: sneed::Env<heed::WithoutTls>,
mainchain_task: MainchainTaskHandle,
mempool: MemPool,
net: Net,
Expand Down Expand Up @@ -138,7 +138,8 @@ where
std::fs::create_dir_all(&env_path)?;
let env = {
use heed::EnvFlags;
let mut env_open_opts = heed::EnvOpenOptions::new();
let mut env_open_opts =
heed::EnvOpenOptions::new().read_txn_without_tls();
env_open_opts
.map_size(128 * 1024 * 1024 * 1024) // 128 GB
.max_dbs(
Expand Down Expand Up @@ -166,8 +167,7 @@ where
| EnvFlags::MAP_ASYNC
| EnvFlags::NO_SYNC
| EnvFlags::NO_META_SYNC
| EnvFlags::NO_READ_AHEAD
| EnvFlags::NO_TLS;
| EnvFlags::NO_READ_AHEAD;
unsafe { env_open_opts.flags(fast_flags) };
unsafe { Env::open(&env_open_opts, &env_path) }
.map_err(EnvError::from)?
Expand Down Expand Up @@ -210,7 +210,7 @@ where
})
}

pub fn env(&self) -> &Env {
pub fn env(&self) -> &Env<heed::WithoutTls> {
&self.env
}

Expand Down
8 changes: 4 additions & 4 deletions lib/node/net_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ fn is_fatal_reorg_error(err: &Error) -> bool {
!matches!(err, Error::State(_))
}

fn reorg_to_tip(
env: &sneed::Env,
fn reorg_to_tip<ThreadLocalStorage>(
env: &sneed::Env<ThreadLocalStorage>,
archive: &Archive,
mempool: &MemPool,
state: &State,
Expand Down Expand Up @@ -447,7 +447,7 @@ fn reorg_to_tip(

#[derive(Clone)]
struct NetTaskContext {
env: sneed::Env,
env: sneed::Env<heed::WithoutTls>,
archive: Archive,
mainchain_task: MainchainTaskHandle,
mempool: MemPool,
Expand Down Expand Up @@ -1213,7 +1213,7 @@ impl NetTaskHandle {
#[allow(clippy::too_many_arguments)]
pub fn new(
runtime: &tokio::runtime::Runtime,
env: sneed::Env,
env: sneed::Env<heed::WithoutTls>,
archive: Archive,
mainchain_task: MainchainTaskHandle,
mainchain_task_response_rx: UnboundedReceiver<mainchain_task::Response>,
Expand Down
2 changes: 1 addition & 1 deletion lib/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub struct State {
impl State {
pub const NUM_DBS: u32 = 11;

pub fn new(env: &sneed::Env) -> Result<Self, Error> {
pub fn new<Tls>(env: &sneed::Env<Tls>) -> Result<Self, Error> {
let mut rwtxn = env.write_txn().map_err(EnvError::from)?;
let tip = DatabaseUnique::create(env, &mut rwtxn, "tip")
.map_err(EnvError::from)?;
Expand Down
Loading
Loading