Skip to content

Commit 515548a

Browse files
authored
fix(l1): use fullsync in dev mode (#4795)
**Motivation** <!-- Why does this pull request exist? What are its goals? --> `--dev` mode was broken when set `snap` as default syncmode. **Description** <!-- A clear and concise general description of the changes this PR introduces --> If `--dev` flag is set, use always fullsync. <!-- Link to issues: Resolves #111, Resolves #222 -->
1 parent 07cb649 commit 515548a

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

cmd/ethrex/initializers.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use ethrex_p2p::{
1616
network::P2PContext,
1717
peer_handler::PeerHandler,
1818
rlpx::l2::l2_connection::P2PBasedContext,
19+
sync::SyncMode,
1920
sync_manager::SyncManager,
2021
types::{Node, NodeRecord},
2122
utils::public_key_from_signing_key,
@@ -135,10 +136,17 @@ pub async fn init_rpc_api(
135136
extra_data: String,
136137
) {
137138
init_datadir(&opts.datadir);
139+
140+
let syncmode = if opts.dev {
141+
&SyncMode::Full
142+
} else {
143+
&opts.syncmode
144+
};
145+
138146
// Create SyncManager
139147
let syncer = SyncManager::new(
140148
peer_handler.clone(),
141-
opts.syncmode.clone(),
149+
syncmode,
142150
cancel_token,
143151
blockchain.clone(),
144152
store.clone(),

cmd/ethrex/l2/initializers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async fn init_rpc_api(
4949
// Create SyncManager
5050
let syncer = SyncManager::new(
5151
peer_handler.clone(),
52-
opts.syncmode.clone(),
52+
&opts.syncmode,
5353
cancel_token,
5454
blockchain.clone(),
5555
store.clone(),

crates/networking/p2p/sync_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub struct SyncManager {
3535
impl SyncManager {
3636
pub async fn new(
3737
peer_handler: PeerHandler,
38-
sync_mode: SyncMode,
38+
sync_mode: &SyncMode,
3939
cancel_token: CancellationToken,
4040
blockchain: Arc<Blockchain>,
4141
store: Store,

0 commit comments

Comments
 (0)