Skip to content

Commit bbf77f1

Browse files
committed
fmt
1 parent aeb2077 commit bbf77f1

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

miner/src/cli/command.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,16 @@ pub async fn execute_command(
285285
std::process::exit(1);
286286
};
287287

288-
match compute_node_ops.add_compute_node().await {
288+
let gpu_count: u32 = match &node_config.compute_specs {
289+
Some(specs) => specs
290+
.gpu
291+
.as_ref()
292+
.map(|gpu| gpu.count.unwrap_or(0))
293+
.unwrap_or(0),
294+
None => 0,
295+
};
296+
297+
match compute_node_ops.add_compute_node(gpu_count).await {
289298
Ok(added_node) => {
290299
if added_node {
291300
// If we are adding a new compute node we wait for a proper

miner/src/operations/compute_node.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ impl<'c> ComputeNodeOperations<'c> {
2929
}
3030

3131
// Returns true if the compute node was added, false if it already exists
32-
pub async fn add_compute_node(&self) -> Result<bool, Box<dyn std::error::Error>> {
32+
pub async fn add_compute_node(
33+
&self,
34+
gpu_count: u32,
35+
) -> Result<bool, Box<dyn std::error::Error>> {
3336
Console::section("🔄 Adding compute node");
3437
let compute_node = self
3538
.compute_registry
@@ -77,7 +80,7 @@ impl<'c> ComputeNodeOperations<'c> {
7780
.as_bytes();
7881

7982
// Create the signature bytes
80-
let compute_units: U256 = U256::from(1000);
83+
let compute_units: U256 = U256::from(1000 * gpu_count);
8184
let add_node_tx = self
8285
.prime_network
8386
.add_compute_node(node_address, compute_units, signature.to_vec())

0 commit comments

Comments
 (0)