aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/pss/testdata/addpsstodiscoverytestsnapshot.pl
diff options
context:
space:
mode:
Diffstat (limited to 'swarm/pss/testdata/addpsstodiscoverytestsnapshot.pl')
-rw-r--r--swarm/pss/testdata/addpsstodiscoverytestsnapshot.pl28
1 files changed, 28 insertions, 0 deletions
diff --git a/swarm/pss/testdata/addpsstodiscoverytestsnapshot.pl b/swarm/pss/testdata/addpsstodiscoverytestsnapshot.pl
new file mode 100644
index 000000000..b75cc9894
--- /dev/null
+++ b/swarm/pss/testdata/addpsstodiscoverytestsnapshot.pl
@@ -0,0 +1,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);