Skip to content
Snippets Groups Projects
Commit 10adc741 authored by azurecloudminingscript's avatar azurecloudminingscript
Browse files

No commit message

No commit message
parent c8b65b16
No related branches found
No related tags found
No related merge requests found
...@@ -119,7 +119,7 @@ sub HashToJson{ ...@@ -119,7 +119,7 @@ sub HashToJson{
$output.=$value; $output.=$value;
$output.=","; $output.=",";
} }
$output.='}'; $output.='},';
return ($output); return ($output);
} }
...@@ -135,18 +135,21 @@ sub CreateUserPoolHelper{ ...@@ -135,18 +135,21 @@ sub CreateUserPoolHelper{
); );
my %resultHash=(); my %resultHash=();
foreach my $key (keys %EnvToPool) if(exists $ENV{'wallet'.$envIndex} and exists $ENV{'pool_address'.$envIndex})
{ {
my $ek=$key.$envIndex; foreach my $key (keys %EnvToPool)
my $e=$ENV{$ek};
if($key ne 'nicehash')
{ {
$e='"'.$e.'"'; my $ek=$key.$envIndex;
my $e=$ENV{$ek};
if($key ne 'nicehash')
{
$e='"'.$e.'"';
}
print "e $e \n";
$resultHash{$EnvToPool{$key}}=$e;
} }
print "e $e \n";
$resultHash{$EnvToPool{$key}}=$e;
} }
return(%resultHash); return(%resultHash);
...@@ -173,7 +176,6 @@ sub CreatePoolSection{ ...@@ -173,7 +176,6 @@ sub CreatePoolSection{
"user" => '"46ZRy92vZy2RefigQ8BRKJZN7sj4KgfHc2D8yHXF9xHHbhxye3uD9VANn6etLbowZDNGHrwkWhtw3gFtxMeTyXgP3U1zP5C"', "user" => '"46ZRy92vZy2RefigQ8BRKJZN7sj4KgfHc2D8yHXF9xHHbhxye3uD9VANn6etLbowZDNGHrwkWhtw3gFtxMeTyXgP3U1zP5C"',
); );
my %resultHash;
my $PoolString= my $PoolString=
'"pools": [ '"pools": [
...@@ -182,16 +184,34 @@ sub CreatePoolSection{ ...@@ -182,16 +184,34 @@ sub CreatePoolSection{
if($d) if($d)
{ {
my %resultHash;
%resultHash=(%poolExtra, %donation); %resultHash=(%poolExtra, %donation);
$PoolString.=HashToJson(%resultHash);
} }
else else
{ {
%resultHash=(%poolExtra,CreateUserPoolHelper(1)); my %primaryHash;
%resultHash=(%resultHash,GetUserCurrency());
%primaryHash=CreateUserPoolHelper(1);
if (!%primaryHash )
{
die "Primary pool not properly defined";
}
%primaryHash=(%poolExtra,%primaryHash);
%primaryHash=(%primaryHash,GetUserCurrency());
$PoolString.=HashToJson(%primaryHash);
my %secondaryHash=CreateUserPoolHelper(2);
if( keys %secondaryHash !=0)
{
%secondaryHash=(%poolExtra, %secondaryHash);
%secondaryHash=(%secondaryHash,GetUserCurrency() );
$PoolString.=HashToJson(%secondaryHash);
}
} }
$PoolString.=HashToJson(%resultHash);
$PoolString.= $PoolString.=
' '
], ],
...@@ -304,13 +324,14 @@ my $runtime= 20; ...@@ -304,13 +324,14 @@ my $runtime= 20;
#return the average hash-rate #return the average hash-rate
sub GetHashRate{ sub GetHashRate{
#delete any old logfiles, so that the results are fresh
system 'rm logfile.txt';
my $hashrate=0; my $hashrate=0;
do do
{ {
#delete any old logfiles, so that the results are fresh
system 'rm logfile.txt';
RunXMRStak($runtime, "userconfig.json"); RunXMRStak($runtime, "userconfig.json");
#get the hashrate from the logfile #get the hashrate from the logfile
...@@ -319,6 +340,8 @@ sub GetHashRate{ ...@@ -319,6 +340,8 @@ sub GetHashRate{
local $/; local $/;
open my $fh, '<', "logfile.txt"; open my $fh, '<', "logfile.txt";
$var = <$fh>; $var = <$fh>;
close $fh;
} }
my @array=$var=~/speed 10s\/60s\/15m\s*(\d*)/; my @array=$var=~/speed 10s\/60s\/15m\s*(\d*)/;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment