Skip to content

Commit a44a36e

Browse files
committed
refactor(node/router): improve disconnect error propagation in the router
1 parent c6093fa commit a44a36e

File tree

23 files changed

+438
-319
lines changed

23 files changed

+438
-319
lines changed

Cargo.lock

Lines changed: 49 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/bft/events/src/disconnect.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ pub enum DisconnectReason {
2929
ProtocolViolation,
3030
/// The peer's client is outdated, judging by its version.
3131
OutdatedClientVersion,
32+
/// The two validators are the same node.
33+
SelfConnect,
3234
}
3335

3436
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
@@ -64,6 +66,7 @@ impl FromBytes for Disconnect {
6466
Ok(1) => DisconnectReason::NoReasonGiven,
6567
Ok(2) => DisconnectReason::ProtocolViolation,
6668
Ok(3) => DisconnectReason::OutdatedClientVersion,
69+
Ok(4) => DisconnectReason::SelfConnect,
6770
_ => return Err(io::Error::other("Invalid 'Disconnect' event")),
6871
};
6972

@@ -86,6 +89,7 @@ mod tests {
8689
DisconnectReason::NoReasonGiven,
8790
DisconnectReason::InvalidChallengeResponse,
8891
DisconnectReason::OutdatedClientVersion,
92+
DisconnectReason::SelfConnect,
8993
];
9094

9195
for reason in all_reasons.iter() {

0 commit comments

Comments
 (0)