Skip to content

Commit

Permalink
Move round timeout to const
Browse files Browse the repository at this point in the history
  • Loading branch information
pool2win committed Nov 26, 2024
1 parent fa78c28 commit a89946f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/node/protocol/dkg/trigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ use frost_secp256k1::keys::{KeyPackage, PublicKeyPackage};
use tokio::time::{Duration, Instant};
use tower::{BoxError, ServiceExt};

/// Timeout in seconds, for DKG rounds one and two.
const DKG_ROUND_TIMEOUT: u64 = 10;

/// Runs the DKG trigger loop.
/// This will trigger the DKG round one protocol at a given interval.
pub async fn run_dkg_trigger(
Expand Down Expand Up @@ -76,7 +79,7 @@ fn build_round1_future(
// Build round1 service as future
log::info!("Sending DKG echo broadcast");
let echo_broadcast_timeout_service = tower::ServiceBuilder::new()
.timeout(Duration::from_secs(10))
.timeout(Duration::from_secs(DKG_ROUND_TIMEOUT))
.service(echo_broadcast_service);

echo_broadcast_timeout_service
Expand All @@ -92,7 +95,7 @@ fn build_round2_future(
// Build round2 service as future
log::info!("Sending DKG round two message");
let round_two_timeout_service = tower::ServiceBuilder::new()
.timeout(Duration::from_secs(10))
.timeout(Duration::from_secs(DKG_ROUND_TIMEOUT))
.service(protocol_service);

round_two_timeout_service.oneshot(dkg::round_two::PackageMessage::new(node_id, None).into())
Expand Down

0 comments on commit a89946f

Please sign in to comment.