Skip to content

Commit fd7a4e5

Browse files
committed
apply rabbit comments
Signed-off-by: Roland Kuhn <rk@rkuhn.info>
1 parent b4a4b52 commit fd7a4e5

3 files changed

Lines changed: 16 additions & 12 deletions

File tree

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ target/
2323
*.snap.new
2424

2525
# Files downloaded for the demo
26-
snapshots/
27-
!crates/amaru/tests/snapshots
26+
/snapshots/
2827

2928
# Files for local coverage reports
3029
coverage/
@@ -39,4 +38,3 @@ coverage/
3938

4039
# Cardano node support files
4140
/cardano-node-config/
42-
/snapshots/

crates/amaru/src/stages/consensus/chain_forward/client_state.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ impl ClientState {
5050
}
5151

5252
/// Find headers between points in the chain store.
53-
/// Returns None if none of the points in `points` lies in the past of `start_point`.
53+
/// Returns None if the local chain is broken.
5454
/// Otherwise returns Some(headers) where headers is a list of headers leading from
55-
/// the first found point in the past of `start_point` matching a point from `points`
56-
/// up to `start_point`.
55+
/// the tallest point from the list that lies in the past of `start_point`.
5756
pub(super) fn find_headers_between(
5857
store: &dyn ChainStore<Header>,
5958
start_point: &Point,

crates/amaru/src/stages/mod.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ use gasket::{
3232
messaging::{tokio::funnel_ports, OutputPort},
3333
runtime::Tether,
3434
};
35-
use pallas_network::{facades::PeerClient, miniprotocols::chainsync::Tip};
35+
use pallas_network::{
36+
facades::PeerClient,
37+
miniprotocols::{chainsync::Tip, Point},
38+
};
3639
use std::{path::PathBuf, sync::Arc};
3740
use tokio::sync::Mutex;
3841

@@ -90,11 +93,15 @@ pub fn bootstrap(
9093
.collect::<Vec<_>>();
9194
let chain_store = RocksDBStore::new(config.chain_dir.clone(), era_history)?;
9295

93-
#[allow(clippy::expect_used)]
94-
let header: Header = chain_store
95-
.load_header(&Hash::from(&tip))
96-
.expect("Tip not found");
97-
let our_tip = Tip(header.pallas_point(), header.block_height());
96+
let our_tip = if let amaru_kernel::Point::Specific(_slot, hash) = &tip {
97+
#[allow(clippy::expect_used)]
98+
let header: Header = chain_store
99+
.load_header(&Hash::from(&**hash))
100+
.expect("Tip not found");
101+
Tip(header.pallas_point(), header.block_height())
102+
} else {
103+
Tip(Point::Origin, 0)
104+
};
98105

99106
let chain_selector = make_chain_selector(tip.clone(), &chain_store, &peer_sessions)?;
100107
let chain_ref = Arc::new(Mutex::new(chain_store));

0 commit comments

Comments
 (0)