small fixes

This commit is contained in:
hinto.janai 2024-04-26 20:11:24 -04:00
parent 5f82c6aa6b
commit 64938bfec0
No known key found for this signature in database
GPG key ID: D47CE05FA175A499
2 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
//! General free functions used (related to `cuprate_database::service`). //! General free functions used (related to `cuprate_database::service`).
//---------------------------------------------------------------------------------------------------- Import //---------------------------------------------------------------------------------------------------- Import
use std::sync::{Arc, RwLock}; use std::sync::Arc;
use crate::{ use crate::{
config::Config, config::Config,
@ -34,7 +34,7 @@ pub fn init(config: Config) -> Result<(DatabaseReadHandle, DatabaseWriteHandle),
let reader_threads = config.reader_threads; let reader_threads = config.reader_threads;
// Initialize the database itself. // Initialize the database itself.
let db = Arc::new(ConcreteEnv::open(config)?); let db: Arc<ConcreteEnv> = Arc::new(ConcreteEnv::open(config)?);
// Spawn the Reader thread pool and Writer. // Spawn the Reader thread pool and Writer.
let readers = DatabaseReadHandle::init(&db, reader_threads); let readers = DatabaseReadHandle::init(&db, reader_threads);

View file

@ -2,7 +2,7 @@
//---------------------------------------------------------------------------------------------------- Import //---------------------------------------------------------------------------------------------------- Import
use std::{ use std::{
sync::{Arc, RwLock}, sync::Arc,
task::{Context, Poll}, task::{Context, Poll},
}; };
@ -247,7 +247,7 @@ fn write_block(env: &ConcreteEnv, block: &VerifiedBlockInformation) -> ResponseR
// the transaction on `add_block()` failures. // the transaction on `add_block()` failures.
tx_rw tx_rw
.abort() .abort()
.expect("TODO: if we cannot maintain atomicity by aborting, should we panic?"); .expect("could not maintain database atomicity by aborting write transaction");
Err(e) Err(e)
} }
} }