Skip to content

Commit

Permalink
Add block_proposal_max_age_secs to ConnectionOptionsFile
Browse files Browse the repository at this point in the history
Signed-off-by: Jacinta Ferrant <[email protected]>
  • Loading branch information
jferrant committed Dec 16, 2024
1 parent 86dc10f commit 82de570
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion stacks-signer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use std::path::PathBuf;
use std::time::Duration;

use blockstack_lib::chainstate::stacks::TransactionVersion;
use blockstack_lib::net::connection::DEFAULT_BLOCK_PROPOSAL_MAX_AGE_SECS;
use clarity::util::hash::to_hex;
use libsigner::SignerEntries;
use serde::Deserialize;
Expand All @@ -39,7 +40,6 @@ const BLOCK_PROPOSAL_VALIDATION_TIMEOUT_MS: u64 = 120_000;
const DEFAULT_FIRST_PROPOSAL_BURN_BLOCK_TIMING_SECS: u64 = 60;
const DEFAULT_TENURE_LAST_BLOCK_PROPOSAL_TIMEOUT_SECS: u64 = 30;
const TENURE_IDLE_TIMEOUT_SECS: u64 = 300;
const DEFAULT_BLOCK_PROPOSAL_MAX_AGE_SECS: u64 = 600;

#[derive(thiserror::Error, Debug)]
/// An error occurred parsing the provided configuration
Expand Down
4 changes: 2 additions & 2 deletions stackslib/src/net/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ use crate::net::{
};

/// The default maximum age in seconds of a block that can be validated by the block proposal endpoint
pub const BLOCK_PROPOSAL_MAX_AGE_SECS: u64 = 600;
pub const DEFAULT_BLOCK_PROPOSAL_MAX_AGE_SECS: u64 = 600;

/// Receiver notification handle.
/// When a message with the expected `seq` value arrives, send it to an expected receiver (possibly
Expand Down Expand Up @@ -573,7 +573,7 @@ impl std::default::Default for ConnectionOptions {
nakamoto_inv_sync_burst_interval_ms: 1_000, // wait 1 second after a sortition before running inventory sync
nakamoto_unconfirmed_downloader_interval_ms: 5_000, // run unconfirmed downloader once every 5 seconds
auth_token: None,
block_proposal_max_age_secs: BLOCK_PROPOSAL_MAX_AGE_SECS,
block_proposal_max_age_secs: DEFAULT_BLOCK_PROPOSAL_MAX_AGE_SECS,
stackerdb_hint_replicas: HashMap::new(),

// no faults on by default
Expand Down
6 changes: 5 additions & 1 deletion testnet/stacks-node/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ use stacks::cost_estimates::fee_scalar::ScalarFeeRateEstimator;
use stacks::cost_estimates::metrics::{CostMetric, ProportionalDotProduct, UnitMetric};
use stacks::cost_estimates::{CostEstimator, FeeEstimator, PessimisticEstimator, UnitEstimator};
use stacks::net::atlas::AtlasConfig;
use stacks::net::connection::ConnectionOptions;
use stacks::net::connection::{ConnectionOptions, DEFAULT_BLOCK_PROPOSAL_MAX_AGE_SECS};
use stacks::net::{Neighbor, NeighborAddress, NeighborKey};
use stacks::types::chainstate::BurnchainHeaderHash;
use stacks::types::EpochList;
Expand Down Expand Up @@ -2234,6 +2234,7 @@ pub struct ConnectionOptionsFile {
pub antientropy_retry: Option<u64>,
pub reject_blocks_pushed: Option<bool>,
pub stackerdb_hint_replicas: Option<String>,
pub block_proposal_max_age_secs: Option<u64>,
}

impl ConnectionOptionsFile {
Expand Down Expand Up @@ -2382,6 +2383,9 @@ impl ConnectionOptionsFile {
.transpose()?
.map(HashMap::from_iter)
.unwrap_or(default.stackerdb_hint_replicas),
block_proposal_max_age_secs: self
.block_proposal_max_age_secs
.unwrap_or(DEFAULT_BLOCK_PROPOSAL_MAX_AGE_SECS),
..default
})
}
Expand Down

0 comments on commit 82de570

Please sign in to comment.