Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pool work with latest vertcoin #902

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/CoiniumServ/CoiniumServ.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CoiniumServ</RootNamespace>
<AssemblyName>CoiniumServ</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
Expand Down Expand Up @@ -149,6 +149,13 @@
<Compile Include="Coin\Config\CoinOptions.cs" />
<Compile Include="Coin\Config\IBlockExplorerOptions.cs" />
<Compile Include="Coin\Config\ICoinOptions.cs" />
<Compile Include="Daemon\Responses\BIP9Softforks.cs" />
<Compile Include="Daemon\Responses\BlockChainInfo.cs" />
<Compile Include="Daemon\Responses\MiningInfoData.cs" />
<Compile Include="Daemon\Responses\NetworkData.cs" />
<Compile Include="Daemon\Responses\NetworkInfo.cs" />
<Compile Include="Daemon\Responses\SoftForksData.cs" />
<Compile Include="Daemon\Responses\WalletInfo.cs" />
<Compile Include="Persistance\Layers\Hybrid\Migrations\M003FixDefaults.cs" />
<Compile Include="Persistance\Providers\Redis\RedisClient.cs" />
<Compile Include="Server\Web\Modules\ContactModule.cs" />
Expand Down
43 changes: 42 additions & 1 deletion src/CoiniumServ/Daemon/DaemonClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,48 @@ public decimal GetHashesPerSec()
/// <returns>An object containing some general information.</returns>
public Info GetInfo()
{
return MakeRequest<Info>("getinfo", null);
Info rval = new Info();
try
{
rval = MakeRequest<Info>("getinfo", null);
}
catch (Exception) // fixme - should only catch if api doesn't exist || if vertcoin. - SCSLATER
{
// VertCoin decided to break protocol - yay!
// -The deprecated RPC `getinfo` was removed. It is recommended that the more specific RPCs are used:
// * `getblockchaininfo`
// * `getnetworkinfo`
// * `getwalletinfo`
// * `getmininginfo`
}
return rval;
}

private Info GetVertCoinInfo()
{
Info rval = new Info();
try
{
BlockChainInfo BCInfo = MakeRequest<BlockChainInfo>("getblockchaininfo", null);
NetworkInfo netInfo = MakeRequest<NetworkInfo>("getnetworkinfo", null);
WalletInfo wallInfo = MakeRequest<WalletInfo>("getwalletinfo", null);
MiningInfoData miningData = MakeRequest<MiningInfoData>("getmininginfo", null);

rval.Version = Convert.ToString(netInfo.version);
rval.ProtocolVersion = netInfo.protocolversion;
rval.WalletVersion = wallInfo.walletversion;
rval.Balance = wallInfo.balance;
rval.Blocks = BCInfo.blocks;
rval.TimeOffset = netInfo.timeoffset;
rval.Connections = netInfo.connections;
rval.Difficulty = BCInfo.difficulty;
rval.KeyPoolEldest = wallInfo.keypoololdest;
rval.KeyPoolSize = wallInfo.keypoolsize;
rval.PayTxFee = wallInfo.paytxfee;
}
catch (Exception) // fixme - should only catch if api doesn't exist || if vertcoin. - SCSLATER
{ }
return rval;
}

[Obsolete("Replaced in v0.7.0 with getblocktemplate, submitblock, getrawmempool")]
Expand Down
16 changes: 16 additions & 0 deletions src/CoiniumServ/Daemon/Responses/BIP9Softforks.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CoiniumServ.Daemon.Responses
{
public class BIP9Softforks
{
public SoftForksData csv { get; set; }
public SoftForksData segwit { get; set; }
public SoftForksData nversionbips { get; set; }

}
}
24 changes: 24 additions & 0 deletions src/CoiniumServ/Daemon/Responses/BlockChainInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CoiniumServ.Daemon.Responses
{
class BlockChainInfo
{
public string chain { get; set; }
public long blocks { get; set; }
public long headers { get; set; }
public string bestblockhash { get; set; }
public double difficulty { get; set; }
public long mediantime { get; set; }
public double verificationprogress { get; set; }
public bool initialblockdownload { get; set; }
public string chainwork { get; set; }
public long size_on_disk { get; set; }
public bool pruned { get; set; }
public BIP9Softforks bip9_softforks { get; set; }
public string warnings { get; set; }
}
}
20 changes: 20 additions & 0 deletions src/CoiniumServ/Daemon/Responses/MiningInfoData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CoiniumServ.Daemon.Responses
{
public class MiningInfoData
{
public long blocks { get; set; }
public long currentblockweight { get; set; }
public long currentblocktx { get; set; }
public double difficulty { get; set; }
public double networkhashps { get; set; }
public long pooledtx { get; set; }
public string chain { get; set; }
public string warnings { get; set; }
}
}
17 changes: 17 additions & 0 deletions src/CoiniumServ/Daemon/Responses/NetworkData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CoiniumServ.Daemon.Responses
{
public class NetworkData
{
public string name { get; set; }
public bool limited { get; set; }
public bool reachable { get; set; }
public string proxy { get; set; }
public bool proxy_randomize_credentials { get; set; }
}
}
21 changes: 21 additions & 0 deletions src/CoiniumServ/Daemon/Responses/NetworkInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CoiniumServ.Daemon.Responses
{
public class NetworkInfo
{
public long version { get; set; }
public string subversion { get; set; }
public int protocolversion { get; set; }
public string localservices { get; set; }
public bool localrelay { get; set; }
public long timeoffset { get; set; }
public long networkactive { get; set; }
public long connections { get; set; }
public NetworkData[] networks {get; set;}
}
}
16 changes: 16 additions & 0 deletions src/CoiniumServ/Daemon/Responses/SoftForksData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CoiniumServ.Daemon.Responses
{
public class SoftForksData
{
public string status { get; set; }
public long startTime { get; set; }
public long timeout { get; set; }
public long since { get; set; }
}
}
23 changes: 23 additions & 0 deletions src/CoiniumServ/Daemon/Responses/WalletInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CoiniumServ.Daemon.Responses
{
public class WalletInfo
{
public string walletname { get; set; }
public int walletversion { get; set; }
public decimal balance { get; set; }
public double unconfirmed_balance { get; set; }
public double immature_balance { get; set; }
public long txcount { get; set; }
public long keypoololdest { get; set; }
public long keypoolsize { get; set; }
public long keypoolsize_hd_internal { get; set; }
public decimal paytxfee { get; set; }
public string hdmasterkeyid { get; set; }
}
}