mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
Add additional logs for P2P debugging (#434)
* feat: make logs on network manager more granular * feat: log error on session disconnect * temp: manual peer * temp: manual peer * feat(linear-dl): make BadResponse error more descriptive * feat(linear-dl): log retries on future * chore: add target * chore: add target * chore: remove unused var * chore: remove manual peer override Co-authored-by: Oliver Nordbjerg <hi@notbjerg.me>
This commit is contained in:
@ -21,6 +21,7 @@ futures-util = "0.3.25"
|
||||
|
||||
# misc
|
||||
backon = "0.2.0"
|
||||
tracing = "0.1.37"
|
||||
|
||||
[dev-dependencies]
|
||||
reth-interfaces = { path = "../../interfaces", features = ["test-utils"] }
|
||||
|
||||
@ -208,6 +208,12 @@ where
|
||||
if !fut.inc_err() {
|
||||
return Err(())
|
||||
}
|
||||
tracing::trace!(
|
||||
target : "downloaders::headers",
|
||||
"retrying future attempt: {}/{}",
|
||||
fut.retries,
|
||||
fut.max_retries
|
||||
);
|
||||
let req = self.headers_request();
|
||||
fut.request = req.clone();
|
||||
let client = Arc::clone(&self.client);
|
||||
@ -235,7 +241,7 @@ where
|
||||
headers.sort_unstable_by_key(|h| h.number);
|
||||
|
||||
if headers.is_empty() {
|
||||
return Err(RequestError::BadResponse.into())
|
||||
return Err(RequestError::EmptyHeaders.into())
|
||||
}
|
||||
|
||||
// Iterate headers in reverse
|
||||
@ -255,7 +261,11 @@ where
|
||||
} else if parent.hash() != self.forkchoice.head_block_hash {
|
||||
// The buffer is empty and the first header does not match the
|
||||
// tip, requeue the future
|
||||
return Err(RequestError::BadResponse.into())
|
||||
return Err(RequestError::MismatchedParent(
|
||||
parent.hash(),
|
||||
self.forkchoice.head_block_hash,
|
||||
)
|
||||
.into())
|
||||
}
|
||||
|
||||
// Record new parent
|
||||
@ -328,6 +338,10 @@ where
|
||||
if let Poll::Ready(result) = fut.poll_unpin(cx) {
|
||||
if let Err(err) = this.process_header_response(result) {
|
||||
if this.try_fuse_request_fut(&mut fut).is_err() {
|
||||
tracing::trace!(
|
||||
target: "downloaders::headers",
|
||||
"ran out of retries terminating stream"
|
||||
);
|
||||
// We exhausted all of the retries. Stream must terminate
|
||||
this.done = true;
|
||||
this.buffered.clear();
|
||||
|
||||
Reference in New Issue
Block a user