@@ -21,6 +21,7 @@ use crate::docker::core::docker_command;
2121use crate :: docker:: network:: { lotus_network_name, pdp_miner_network_name} ;
2222use crate :: paths:: foc_devnet_bin;
2323use crate :: paths:: foc_devnet_docker_volumes;
24+ use crate :: paths:: foc_devnet_genesis_sectors_pdp_sp;
2425use std:: error:: Error ;
2526use std:: thread;
2627use std:: time:: Duration ;
@@ -179,6 +180,10 @@ fn create_base_cluster(
179180 let lotus_data_dir = foc_devnet_docker_volumes ( ) . join ( "lotus-data" ) ;
180181 let lotus_data_mount = bind_mount ( & lotus_data_dir, "/lotus-data" ) ?;
181182
183+ // Needed to import this miner's worker key below
184+ let genesis_sectors_dir = foc_devnet_genesis_sectors_pdp_sp ( run_id, sp_index) ;
185+ let genesis_sectors_mount = bind_mount ( & genesis_sectors_dir, "/genesis-sectors" ) ?;
186+
182187 // Create a unique container name for this operation
183188 let container_name = format ! ( "foc-{}-curio-db-setup-{}" , run_id, sp_index) ;
184189
@@ -194,6 +199,8 @@ fn create_base_cluster(
194199 & bin_mount,
195200 "--mount" ,
196201 & lotus_data_mount,
202+ "--mount" ,
203+ & genesis_sectors_mount,
197204 ] ;
198205
199206 // Add environment variables for database connection
@@ -219,10 +226,12 @@ fn create_base_cluster(
219226 docker_args. push ( "-e" ) ;
220227 docker_args. push ( crate :: constants:: CURIO_LOG_LEVEL ) ;
221228
222- // Add image and command
229+ // `new-cluster` writes this miner's address into the base layer config,
230+ // so also import its worker key into the shared Lotus daemon.
223231 let bash_cmd = format ! (
224- "sleep 3 && /usr/local/bin/lotus-bins/curio config new-cluster {}" ,
225- miner_id
232+ "sleep 3 && /usr/local/bin/lotus-bins/curio config new-cluster {miner_id} && \
233+ /usr/local/bin/lotus-bins/lotus wallet import /genesis-sectors/pre-seal-{miner_id}.key",
234+ miner_id = miner_id
226235 ) ;
227236 docker_args. extend_from_slice ( & [
228237 crate :: constants:: CURIO_DOCKER_IMAGE ,
0 commit comments