Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: save rescanning progress #472

Merged
merged 1 commit into from
Jun 5, 2023
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
27 changes: 14 additions & 13 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub trait Service<Config, InnerError> {
monitoring_config: MonitoringConfig,
shutdown: ShutdownSender,
constructor: Box<dyn Fn(VaultId) -> Result<DynBitcoinCoreApi, BitcoinError> + Send + Sync>,
keyname: String,
) -> Self;
async fn start(&self) -> Result<(), Error<InnerError>>;
}
Expand All @@ -46,6 +47,7 @@ pub struct ConnectionManager<Config: Clone, F: Fn()> {
monitoring_config: MonitoringConfig,
config: Config,
increment_restart_counter: F,
db_path: String,
}

impl<Config: Clone + Send + 'static, F: Fn()> ConnectionManager<Config, F> {
Expand All @@ -59,6 +61,7 @@ impl<Config: Clone + Send + 'static, F: Fn()> ConnectionManager<Config, F> {
monitoring_config: MonitoringConfig,
config: Config,
increment_restart_counter: F,
db_path: String,
) -> Self {
Self {
signer,
Expand All @@ -69,6 +72,7 @@ impl<Config: Clone + Send + 'static, F: Fn()> ConnectionManager<Config, F> {
monitoring_config,
config,
increment_restart_counter,
db_path,
}
}

Expand Down Expand Up @@ -122,6 +126,7 @@ impl<Config: Clone + Send + 'static, F: Fn()> ConnectionManager<Config, F> {
self.monitoring_config.clone(),
shutdown_tx.clone(),
Box::new(constructor),
self.db_path.clone(),
);
match service.start().await {
Err(err @ Error::Abort(_)) => {
Expand Down
2 changes: 2 additions & 0 deletions vault/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ lazy_static = "1.4"
governor = "0.5.0"
nonzero_ext = "0.3.0"

rocksdb = { version = "0.19.0", features = ["snappy"], default-features = false }

tracing = { version = "0.1", features = ["log"] }
tracing-subscriber = { version = "0.2.12", features = ["registry", "env-filter", "fmt"] }
tracing-futures = { version = "0.2.5" }
Expand Down
10 changes: 10 additions & 0 deletions vault/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
use std::string::FromUtf8Error;

use bitcoin::Error as BitcoinError;
use jsonrpc_core_client::RpcError;
use parity_scale_codec::Error as CodecError;
use rocksdb::Error as RocksDbError;
use runtime::Error as RuntimeError;
use serde_json::Error as SerdeJsonError;
use thiserror::Error;
use tokio_stream::wrappers::errors::BroadcastStreamRecvError;

Expand Down Expand Up @@ -32,6 +36,12 @@ pub enum Error {
RuntimeError(#[from] RuntimeError),
#[error("CodecError: {0}")]
CodecError(#[from] CodecError),
#[error("DatabaseError: {0}")]
DatabaseError(#[from] RocksDbError),
#[error("SerdeJsonError: {0}")]
SerdeJsonError(#[from] SerdeJsonError),
#[error("FromUtf8Error: {0}")]
FromUtf8Error(#[from] FromUtf8Error),
#[error("BroadcastStreamRecvError: {0}")]
BroadcastStreamRecvError(#[from] BroadcastStreamRecvError),
}
Expand Down
Loading