Skip to content

Commit b4f85bb

Browse files
authored
log InconsistentTree as debug while syncing (#4084)
**Motivation** While the node is syncing, we occasionally see warnings with the `InconsistentTree` error. This occurs because requests may ask for data that has not yet been downloaded during sync. Since this situation is expected and not truly an error, the log level should be adjusted. However, if the same issue happens once the node is fully synced, it indicates a real problem and should still be logged as an error. **Description** This change updates the logging logic: * When the node is fully synced: log `InconsistentTree` as `error`. * When the node is syncing: log `InconsistentTree` as `debug`.
1 parent 14bde42 commit b4f85bb

File tree

1 file changed

+19
-2
lines changed
  • crates/networking/p2p/rlpx/connection

1 file changed

+19
-2
lines changed

crates/networking/p2p/rlpx/connection/server.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ use ethrex_common::{
1010
H256,
1111
types::{MempoolTransaction, Transaction},
1212
};
13-
use ethrex_storage::Store;
13+
use ethrex_storage::{Store, error::StoreError};
14+
use ethrex_trie::TrieError;
1415
use futures::{SinkExt as _, Stream, stream::SplitSink};
1516
use rand::random;
1617
use secp256k1::{PublicKey, SecretKey};
@@ -347,6 +348,19 @@ impl GenServer for RLPxConnection {
347348
);
348349
return CastResponse::Stop;
349350
}
351+
RLPxError::StoreError(StoreError::Trie(TrieError::InconsistentTree)) => {
352+
if established_state.blockchain.is_synced() {
353+
log_peer_error(
354+
&established_state.node,
355+
&format!("Error handling cast message: {e}"),
356+
);
357+
} else {
358+
log_peer_debug(
359+
&established_state.node,
360+
&format!("Error handling cast message: {e}"),
361+
);
362+
}
363+
}
350364
_ => {
351365
log_peer_warn(
352366
&established_state.node,
@@ -467,7 +481,10 @@ where
467481
Ok(())
468482
}
469483

470-
async fn send_new_pooled_tx_hashes(state: &mut Established, txs: Vec<MempoolTransaction>) -> Result<(), RLPxError> {
484+
async fn send_new_pooled_tx_hashes(
485+
state: &mut Established,
486+
txs: Vec<MempoolTransaction>,
487+
) -> Result<(), RLPxError> {
471488
if SUPPORTED_ETH_CAPABILITIES
472489
.iter()
473490
.any(|cap| state.capabilities.contains(cap))

0 commit comments

Comments
 (0)