Skip to content

Commit 979fefe

Browse files
committed
chore: add config setting for stackerdb_hint_replicas; also make private_neighbors false by default
1 parent 8a44ece commit 979fefe

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

testnet/stacks-node/src/config.rs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ use stacks::cost_estimates::metrics::{CostMetric, ProportionalDotProduct, UnitMe
5050
use stacks::cost_estimates::{CostEstimator, FeeEstimator, PessimisticEstimator, UnitEstimator};
5151
use stacks::net::atlas::AtlasConfig;
5252
use stacks::net::connection::ConnectionOptions;
53-
use stacks::net::{Neighbor, NeighborKey};
53+
use stacks::net::{Neighbor, NeighborAddress, NeighborKey};
5454
use stacks::types::chainstate::BurnchainHeaderHash;
5555
use stacks::types::EpochList;
5656
use stacks::util_lib::boot::boot_code_id;
@@ -2223,6 +2223,7 @@ pub struct ConnectionOptionsFile {
22232223
pub auth_token: Option<String>,
22242224
pub antientropy_retry: Option<u64>,
22252225
pub reject_blocks_pushed: Option<bool>,
2226+
pub stackerdb_hint_replicas: Option<String>,
22262227
}
22272228

22282229
impl ConnectionOptionsFile {
@@ -2352,12 +2353,34 @@ impl ConnectionOptionsFile {
23522353
handshake_timeout: self.handshake_timeout.unwrap_or(5),
23532354
max_sockets: self.max_sockets.unwrap_or(800) as usize,
23542355
antientropy_public: self.antientropy_public.unwrap_or(true),
2355-
private_neighbors: self.private_neighbors.unwrap_or(true),
2356+
private_neighbors: self.private_neighbors.unwrap_or(false),
23562357
auth_token: self.auth_token,
23572358
antientropy_retry: self.antientropy_retry.unwrap_or(default.antientropy_retry),
23582359
reject_blocks_pushed: self
23592360
.reject_blocks_pushed
23602361
.unwrap_or(default.reject_blocks_pushed),
2362+
stackerdb_hint_replicas: self
2363+
.stackerdb_hint_replicas
2364+
.map(|stackerdb_hint_replicas_json| {
2365+
let hint_replicas_res: Result<
2366+
Vec<(QualifiedContractIdentifier, Vec<NeighborAddress>)>,
2367+
String,
2368+
> = serde_json::from_str(&stackerdb_hint_replicas_json)
2369+
.map_err(|e| format!("Failed to decode `stackerdb_hint_replicas`: {e:?}"));
2370+
hint_replicas_res
2371+
})
2372+
.transpose()?
2373+
.and_then(|stackerdb_replicas_list| {
2374+
// coalesce to a hashmap, but don't worry about duplicate entries
2375+
// (garbage in, garbage out)
2376+
let stackerdb_hint_replicas: HashMap<
2377+
QualifiedContractIdentifier,
2378+
Vec<NeighborAddress>,
2379+
> = stackerdb_replicas_list.into_iter().collect();
2380+
2381+
Some(stackerdb_hint_replicas)
2382+
})
2383+
.unwrap_or(default.stackerdb_hint_replicas),
23612384
..default
23622385
})
23632386
}

testnet/stacks-node/src/neon_node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4810,7 +4810,7 @@ impl StacksNode {
48104810
&mut chainstate,
48114811
&sortdb,
48124812
stackerdb_configs,
4813-
config.connection_options.num_neighbors,
4813+
&config.connection_options,
48144814
)
48154815
.unwrap();
48164816

0 commit comments

Comments
 (0)