Skip to content

Commit 4f8ecc8

Browse files
committed
feat: committor service persists into ledger path
1 parent 644ad1c commit 4f8ecc8

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

magicblock-api/src/magic_validator.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,22 +198,23 @@ impl MagicValidator {
198198
config.validator_config.ledger.reset,
199199
)?;
200200

201-
let exit = Arc::<AtomicBool>::default();
202201
// SAFETY:
203202
// this code will never panic as the ledger_path always appends the
204203
// rocksdb directory to whatever path is preconfigured for the ledger,
205204
// see `Ledger::do_open`, thus this path will always have a parent
206-
let adb_path = ledger
205+
let ledger_parent_path = ledger
207206
.ledger_path()
208207
.parent()
209208
.expect("ledger_path didn't have a parent, should never happen");
209+
210+
let exit = Arc::<AtomicBool>::default();
210211
let bank = Self::init_bank(
211212
Some(geyser_manager.clone()),
212213
&genesis_config,
213214
&config.validator_config.accounts.db,
214215
config.validator_config.validator.millis_per_slot,
215216
validator_pubkey,
216-
adb_path,
217+
ledger_parent_path,
217218
ledger.get_max_blockhash().map(|(slot, _)| slot)?,
218219
)?;
219220

@@ -310,10 +311,15 @@ impl MagicValidator {
310311
&faucet_keypair.pubkey(),
311312
);
312313

314+
let committor_persist_path =
315+
ledger_parent_path.join("committor_service.sqlite");
316+
debug!(
317+
"Committor service persists to: {}",
318+
committor_persist_path.display()
319+
);
313320
let committor_service = Arc::new(CommittorService::try_start(
314321
identity_keypair.insecure_clone(),
315-
// TODO: @@@ config or inside ledger dir
316-
"/tmp/committor_service.sqlite",
322+
committor_persist_path,
317323
ChainConfig {
318324
rpc_uri: remote_rpc_config.url().to_string(),
319325
commitment: remote_rpc_config

magicblock-committor-service/src/service.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{fmt::Display, path::Path};
1+
use std::path::Path;
22

33
use log::*;
44
use magicblock_committor_program::Changeset;
@@ -205,12 +205,9 @@ impl CommittorService {
205205
chain_config: ChainConfig,
206206
) -> CommittorServiceResult<Self>
207207
where
208-
P: Display + AsRef<Path>,
208+
P: AsRef<Path>,
209209
{
210-
debug!(
211-
"Starting committor service with config: {:?}, persisting to: {}",
212-
chain_config, persist_file
213-
);
210+
debug!("Starting committor service with config: {:?}", chain_config);
214211
let (sender, receiver) = mpsc::channel(1_000);
215212
let cancel_token = CancellationToken::new();
216213
{

0 commit comments

Comments
 (0)