Skip to content

Commit 2d8bdd4

Browse files
Merge pull request #2344 from threefoldtech/development_fix_mycelium
Fix mycelium validation for the peers
2 parents 95095f9 + 98aac91 commit 2d8bdd4

File tree

1 file changed

+12
-3
lines changed
  • packages/grid_client/src/zos

1 file changed

+12
-3
lines changed

packages/grid_client/src/zos/znet.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
import { Expose, Type } from "class-transformer";
2-
import { ArrayNotEmpty, IsDefined, IsInt, IsNotEmpty, IsString, Length, ValidateNested } from "class-validator";
2+
import {
3+
ArrayNotEmpty,
4+
IsDefined,
5+
IsInt,
6+
IsNotEmpty,
7+
IsOptional,
8+
IsString,
9+
Length,
10+
ValidateNested,
11+
} from "class-validator";
312

413
import { WorkloadData } from "./workload_base";
514

@@ -24,7 +33,7 @@ class Peer {
2433

2534
class Mycelium {
2635
@Expose() @IsString() @IsNotEmpty() hex_key: string;
27-
@Expose() @IsString({ each: true }) peers: string[];
36+
@Expose() @IsOptional() @IsString({ each: true }) peers?: string[];
2837
}
2938

3039
class Znet extends WorkloadData {
@@ -46,7 +55,7 @@ class Znet extends WorkloadData {
4655
out += this.peers[i].challenge();
4756
}
4857
out += this.mycelium?.hex_key || "";
49-
for (let i = 0; i < this.mycelium?.peers.length; i++) {
58+
for (let i = 0; i < this.mycelium?.peers?.length; i++) {
5059
out += this.mycelium?.peers[i] || "";
5160
}
5261
return out;

0 commit comments

Comments
 (0)