@@ -50,7 +50,7 @@ use stacks::cost_estimates::metrics::{CostMetric, ProportionalDotProduct, UnitMe
50
50
use stacks:: cost_estimates:: { CostEstimator , FeeEstimator , PessimisticEstimator , UnitEstimator } ;
51
51
use stacks:: net:: atlas:: AtlasConfig ;
52
52
use stacks:: net:: connection:: ConnectionOptions ;
53
- use stacks:: net:: { Neighbor , NeighborKey } ;
53
+ use stacks:: net:: { Neighbor , NeighborAddress , NeighborKey } ;
54
54
use stacks:: types:: chainstate:: BurnchainHeaderHash ;
55
55
use stacks:: types:: EpochList ;
56
56
use stacks:: util_lib:: boot:: boot_code_id;
@@ -2223,6 +2223,7 @@ pub struct ConnectionOptionsFile {
2223
2223
pub auth_token : Option < String > ,
2224
2224
pub antientropy_retry : Option < u64 > ,
2225
2225
pub reject_blocks_pushed : Option < bool > ,
2226
+ pub stackerdb_hint_replicas : Option < String > ,
2226
2227
}
2227
2228
2228
2229
impl ConnectionOptionsFile {
@@ -2352,12 +2353,34 @@ impl ConnectionOptionsFile {
2352
2353
handshake_timeout : self . handshake_timeout . unwrap_or ( 5 ) ,
2353
2354
max_sockets : self . max_sockets . unwrap_or ( 800 ) as usize ,
2354
2355
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 ) ,
2356
2357
auth_token : self . auth_token ,
2357
2358
antientropy_retry : self . antientropy_retry . unwrap_or ( default. antientropy_retry ) ,
2358
2359
reject_blocks_pushed : self
2359
2360
. reject_blocks_pushed
2360
2361
. 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 ) ,
2361
2384
..default
2362
2385
} )
2363
2386
}
0 commit comments