| 148 | } |
| 149 | |
| 150 | fn register_worker(client: &Client, config: &CliConfig) -> Result<()> { |
| 151 | // Create the worker |
| 152 | let signatory = read_keypair_file(&config.signatory()).map_err(|err| { |
| 153 | CliError::FailedLocalnet(format!( |
| 154 | "Unable to read keypair {}: {}", |
| 155 | &config.signatory(), |
| 156 | err |
| 157 | )) |
| 158 | })?; |
| 159 | |
| 160 | client |
| 161 | .airdrop(&signatory.pubkey(), LAMPORTS_PER_SOL) |
| 162 | .context("airdrop to signatory failed")?; |
| 163 | super::worker::create(client, signatory, true).context("worker::create failed")?; |
| 164 | |
| 165 | // Delegate stake to the worker |
| 166 | super::delegation::create(client, 0).context("delegation::create failed")?; |
| 167 | super::delegation::deposit(client, 100000000, 0, 0).context("delegation::deposit failed")?; |
| 168 | Ok(()) |
| 169 | } |
| 170 | |
| 171 | fn create_threads(client: &Client, mint_pubkey: Pubkey) -> Result<()> { |
| 172 | // Create epoch thread. |