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: penumbra view db filepath #38

Merged
merged 1 commit into from
Jun 19, 2024
Merged
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
23 changes: 22 additions & 1 deletion crates/relayer/src/chain/penumbra/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ use tokio::runtime::Runtime as TokioRuntime;
use tokio::sync::Mutex;
use tonic::IntoRequest;

use std::path::PathBuf;

use crate::{
chain::{
endpoint::{ChainEndpoint, HealthCheck},
Expand Down Expand Up @@ -501,9 +503,28 @@ impl ChainEndpoint for PenumbraChain {

let fvk = config.kms_config.spend_key.full_viewing_key();

// Identify filepath for storing Penumbra view database locally.
// The directory might not be specified, in which case we'll preserve None,
// which causes the ViewServiceClient to use an in-memory database.
let view_file: Option<String> = match config.view_service_storage_dir {
Some(ref dir_string) => {
let p = PathBuf::from(dir_string)
.join("relayer-view.sqlite")
.to_str()
.ok_or_else(|| Error::temp_penumbra_error("Non-UTF8 view path".to_owned()))?
.to_owned();
tracing::info!("using view database at {}", p);
Some(p)
}
None => {
tracing::warn!("using in-memory view database for penumbra; consider setting 'view_service_storage_dir'");
None
}
};

let svc = rt
.block_on(ViewServer::load_or_initialize(
config.view_service_storage_dir.clone(),
view_file,
fvk,
config.grpc_addr.clone().into(),
))
Expand Down
Loading