From 14129bf1261baa38714455646556940d44bc9b11 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 27 Nov 2025 15:40:53 +0100 Subject: [PATCH 1/3] increased gracefull client shutdown from 5 second to 15 seconds. https://github.com/DMDcoin/diamond-node/issues/321 --- bin/oe/run.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/oe/run.rs b/bin/oe/run.rs index 92dc4feb5..c58504c86 100644 --- a/bin/oe/run.rs +++ b/bin/oe/run.rs @@ -723,7 +723,7 @@ impl RunningClient { .name("diamond-node-force-quit".to_string()) .spawn(move || { - let duration_soft = 5; + let duration_soft = 15; // we make a force quit if after 90 seconds, if this shutdown routine std::thread::sleep(Duration::from_secs(duration_soft)); warn!(target: "shutdown", "shutdown not happened within {duration_soft} seconds, starting force exiting the process."); From f93430af7a727a33d89b026d21741d6c866b08ea Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 29 Nov 2025 13:59:08 +0100 Subject: [PATCH 2/3] Node shutdown, if a validator becomes a regular node: https://github.com/DMDcoin/diamond-node/issues/322 --- .../ethcore/src/engines/hbbft/hbbft_state.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/ethcore/src/engines/hbbft/hbbft_state.rs b/crates/ethcore/src/engines/hbbft/hbbft_state.rs index 725e5b75f..0cd959817 100644 --- a/crates/ethcore/src/engines/hbbft/hbbft_state.rs +++ b/crates/ethcore/src/engines/hbbft/hbbft_state.rs @@ -222,10 +222,26 @@ impl HbbftState { } if sks.is_none() { - info!(target: "engine", "We are not part of the HoneyBadger validator set - running as regular node."); + info!(target: "engine", "We are not part of the HoneyBadger validator set - Running as regular node."); peers_service .send_message(HbbftConnectToPeersMessage::DisconnectAllValidators) .ok()?; + + if self.is_validator() { + if client + .as_full_client() + .expect("full client") + .is_major_syncing() + { + debug!(target: "engine", "Node was a validator, and became regular node, but we are syncing, not shutting down Node as defined inhttps://github.com/DMDcoin/diamond-node/issues/322."); + } else { + info!(target: "engine", "Node was a validator, and became regular node. shutting down Node as defined in https://github.com/DMDcoin/diamond-node/issues/322."); + // for unit tests no problem, demand shutddown wont to anything if its a unit test. + // e2e tests needs adaption. + // this gracefully shuts down a node, if it was a validator before, but now it is not anymore. + client.demand_shutdown(); + } + } return Some(()); } From a27cba25934e317633cac67d6af845d0e2e8260b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 1 Dec 2025 17:41:23 +0100 Subject: [PATCH 3/3] Error handling for autoshutdown of ex validators https://github.com/DMDcoin/diamond-node/issues/322 + typo fixes --- .../ethcore/src/engines/hbbft/hbbft_state.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/crates/ethcore/src/engines/hbbft/hbbft_state.rs b/crates/ethcore/src/engines/hbbft/hbbft_state.rs index 0cd959817..fe94ec2bd 100644 --- a/crates/ethcore/src/engines/hbbft/hbbft_state.rs +++ b/crates/ethcore/src/engines/hbbft/hbbft_state.rs @@ -228,16 +228,19 @@ impl HbbftState { .ok()?; if self.is_validator() { - if client - .as_full_client() - .expect("full client") - .is_major_syncing() - { - debug!(target: "engine", "Node was a validator, and became regular node, but we are syncing, not shutting down Node as defined inhttps://github.com/DMDcoin/diamond-node/issues/322."); + let is_syncing = if let Some(full) = client.as_full_client() { + full.is_major_syncing() + } else { + info!(target: "engine", "Node was a validator: cannot be determinated, because client is not a full client. (https://github.com/DMDcoin/diamond-node/issues/322.)"); + return Some(()); + }; + + if is_syncing { + debug!(target: "engine", "Node was a validator, and became regular node, but we are syncing, not shutting down Node as defined in https://github.com/DMDcoin/diamond-node/issues/322."); } else { info!(target: "engine", "Node was a validator, and became regular node. shutting down Node as defined in https://github.com/DMDcoin/diamond-node/issues/322."); - // for unit tests no problem, demand shutddown wont to anything if its a unit test. - // e2e tests needs adaption. + // for unit tests no problem, demand shutddown won't to anything if its a unit test. + // e2e tests needs adaptation. // this gracefully shuts down a node, if it was a validator before, but now it is not anymore. client.demand_shutdown(); }