aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/pss/testdata/addpsstodiscoverytestsnapshot.pl
blob: b75cc9894addc25959ce04d94274d2b15cde9efa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl

use JSON;

my $f;
my $jsontext;
my $nodelist;
my $network;

open($f, "<", $ARGV[0]) || die "cant open " . $ARGV[0];
while (<$f>) {
    $jsontext .= $_;
}
close($f);

$network = decode_json($jsontext);
$nodelist = $network->{'nodes'};

for ($i = 0; $i < 0+@$nodelist; $i++) {
    #my $protocollist = $$nodelist[$i]{'node'}{'info'}{'protocols'};
    #$$protocollist{'pss'} = "pss";
    my $svc = $$nodelist[$i]{'node'}{'config'}{'services'};
    pop(@$svc);
    push(@$svc, "pss");
    push(@$svc, "bzz");
}

print encode_json($network);