-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
137 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
crates/rooch/src/commands/db/commands/get_changeset_by_order.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::commands::db::commands::init; | ||
use clap::Parser; | ||
use rooch_config::R_OPT_NET_HELP; | ||
use rooch_store::state_store::StateStore; | ||
use rooch_types::error::RoochResult; | ||
use rooch_types::rooch_network::RoochChainID; | ||
use std::path::PathBuf; | ||
|
||
/// Get changeset by order | ||
#[derive(Debug, Parser)] | ||
pub struct GetChangesetByOrderCommand { | ||
#[clap(long)] | ||
pub order: u64, | ||
|
||
#[clap(long = "data-dir", short = 'd')] | ||
/// Path to data dir, this dir is base dir, the final data_dir is base_dir/chain_network_name | ||
pub base_data_dir: Option<PathBuf>, | ||
|
||
/// If local chainid, start the service with a temporary data store. | ||
/// All data will be deleted when the service is stopped. | ||
#[clap(long, short = 'n', help = R_OPT_NET_HELP)] | ||
pub chain_id: Option<RoochChainID>, | ||
} | ||
|
||
impl GetChangesetByOrderCommand { | ||
pub async fn execute(self) -> RoochResult<()> { | ||
let (_root, rooch_db, _start_time) = init(self.base_data_dir, self.chain_id); | ||
let rooch_store = rooch_db.rooch_store; | ||
let tx_order = self.order; | ||
let state_change_set_ext_opt = rooch_store.get_state_change_set(tx_order)?; | ||
println!("{:?}", state_change_set_ext_opt); | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters