Skip to content

Commit

Permalink
Merge pull request #344 from raistlinthewiz/develop
Browse files Browse the repository at this point in the history
Added block-explorer link support for coin-configs
  • Loading branch information
Hüseyin Uslu committed Aug 7, 2014
2 parents 6a72bfd + 62b0896 commit 78c181a
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 10 deletions.
3 changes: 3 additions & 0 deletions src/CoiniumServ/Coin/Config/CoinConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#endregion

using System;
using CoiniumServ.Daemon.Responses;
using Serilog;

namespace CoiniumServ.Coin.Config
Expand All @@ -32,6 +33,7 @@ public class CoinConfig : ICoinConfig
public string Name { get; private set; }
public string Symbol { get; private set; }
public string Algorithm { get; private set; }
public string BlockExplorer { get; private set; }
public dynamic Options { get; private set; }

public CoinConfig(dynamic config)
Expand All @@ -41,6 +43,7 @@ public CoinConfig(dynamic config)
Name = config.name;
Symbol = config.symbol;
Algorithm = config.algorithm;
BlockExplorer = string.IsNullOrEmpty(config.blockExplorer) ? "https://altexplorer.net" : config.blockExplorer;
Options = config;

if (Name == null || Symbol == null || Algorithm == null) // make sure we have valid name, symbol and algorithm data.
Expand Down
5 changes: 5 additions & 0 deletions src/CoiniumServ/Coin/Config/ICoinConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public interface ICoinConfig:IConfig
/// </summary>
string Algorithm { get; }

/// <summary>
/// Block explorer for the coin.
/// </summary>
string BlockExplorer { get; }

/// <summary>
/// Extra options provided that will be passed to coin algorithm.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/CoiniumServ/Persistance/Blocks/PendingBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public BlockStatus Status

public string BlockHash
{
get { return IsFinalized ? Finalized.BlockHash : "Many.."; }
get { return IsFinalized ? Finalized.BlockHash : Candidates.First().BlockHash; }
}

public string TransactionHash
{
get { return IsFinalized ? Finalized.BlockHash : "Many.."; }
get { return IsFinalized ? Finalized.BlockHash : Candidates.First().TransactionHash; }
}

public decimal Reward
Expand Down
3 changes: 2 additions & 1 deletion src/CoiniumServ/config/coins/anoncoin.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "Anoncoin",
"symbol": "ANC",
"algorithm": "scrypt"
"algorithm": "scrypt",
"blockExplorer": "http://ancblockchain.com"
}
3 changes: 2 additions & 1 deletion src/CoiniumServ/config/coins/bitcoin.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "Bitcoin",
"symbol": "BTC",
"algorithm": "sha256"
"algorithm": "sha256",
"blockExplorer": "https://blockchain.info"
}
3 changes: 2 additions & 1 deletion src/CoiniumServ/config/coins/catcoin.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "Catcoin",
"symbol": "CAT",
"algorithm": "scrypt"
"algorithm": "scrypt",
"blockExplorer": "http://catchain.info"
}
1 change: 1 addition & 0 deletions src/CoiniumServ/config/coins/darkcoin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"name": "Darkcoin",
"symbol": "DRK",
"algorithm": "x11",
"blockExplorer": "http://explorer.darkcoin.io",
"mposDiffMultiplier": 256
}
3 changes: 2 additions & 1 deletion src/CoiniumServ/config/coins/digibyte.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "Digibyte",
"symbol": "DGB",
"algorithm": "scrypt"
"algorithm": "scrypt",
"blockExplorer": "https://altexplorer.net"
}
1 change: 1 addition & 0 deletions src/CoiniumServ/config/coins/dogecoin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "Dogecoin",
"symbol": "DOGE",
"algorithm": "scrypt",
"blockExplorer": "https://dogechain.info",
"peerMagic": "c0c0c0c0",
"peerMagicTestnet": "fcc1b7dc"
}
3 changes: 2 additions & 1 deletion src/CoiniumServ/config/coins/earthcoin.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "Earthcoin",
"symbol": "EAC",
"algorithm": "scrypt"
"algorithm": "scrypt",
"blockExplorer": "http://earthchain.info"
}
3 changes: 2 additions & 1 deletion src/CoiniumServ/config/coins/einsteinium.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "Einsteinium",
"symbol": "EMC2",
"algorithm": "scrypt"
"algorithm": "scrypt",
"blockExplorer": "https://altexplorer.net"
}
3 changes: 2 additions & 1 deletion src/CoiniumServ/config/coins/feathercoin.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "Feathercoin",
"symbol": "FTC",
"algorithm": "scrypt"
"algorithm": "scrypt",
"blockExplorer": "https://explorer.feathercoin.com"
}
1 change: 1 addition & 0 deletions src/CoiniumServ/config/coins/litecoin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "Litecoin",
"symbol": "LTC",
"algorithm": "scrypt",
"blockExplorer": "http://block-explorer.com",
"peerMagic": "fbc0b6db",
"peerMagicTestnet": "fcc1b7dc"
}
2 changes: 1 addition & 1 deletion src/CoiniumServ/web/default/pool.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
@foreach (var block in Model.Pool.Statistics.Blocks.Latest)
{
<tr>
<td><a href="https://chain.so/block/LTCTEST/@block.Height" target="_blank">@block.Height</a></td>
<td><a href="@Model.Pool.Config.Coin.BlockExplorer/block/@block.BlockHash" target="_blank">@block.Height</a></td>
<td>
@switch (block.Status)
{
Expand Down

0 comments on commit 78c181a

Please sign in to comment.