-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed getblocktemplate() - invalid mode bug for peercoin and variants…
…. Needs a coin.json configuration option though. Added TimeConverter support for Block.cs:Time so peercoin variants is also supported - which can read utc time-strings. Improved Transaction.cs:GetPoolOutput() so it can also support peercoin variants. Updated TimeHelpers.cs. Fixes #442. Fixes #410.
- Loading branch information
bonesoul
committed
Sep 23, 2014
1 parent
e30afc0
commit 658ebbe
Showing
19 changed files
with
134 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#region License | ||
// | ||
// CoiniumServ - Crypto Currency Mining Pool Server Software | ||
// Copyright (C) 2013 - 2014, CoiniumServ Project - http://www.coinium.org | ||
// http://www.coiniumserv.com - https://github.com/CoiniumServ/CoiniumServ | ||
// | ||
// This software is dual-licensed: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// For the terms of this license, see licenses/gpl_v3.txt. | ||
// | ||
// Alternatively, you can license this software under a commercial | ||
// license or white-label it as set out in licenses/commercial.txt. | ||
// | ||
#endregion | ||
|
||
using System; | ||
using System.Globalization; | ||
using CoiniumServ.Utils.Helpers.Time; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
|
||
namespace CoiniumServ.Daemon.Converters | ||
{ | ||
/// <summary> | ||
/// Custom json converter for time fields which can parse int32 unix-time for bitcoin variants and utc time-string for peercoin variants. | ||
/// </summary> | ||
public class TimeConverter : JsonConverter | ||
{ | ||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | ||
{ | ||
DateTime dateTime; | ||
Int32 unixTime; | ||
|
||
var token = JToken.Load(reader); // read the difficulty token. | ||
|
||
// bitcoin variants use an Int32 for time. | ||
if (int.TryParse(token.ToString(), out unixTime)) // try parsing as int32 | ||
return unixTime; | ||
|
||
// peercoin variants use a date-time string. | ||
if (DateTime.TryParseExact(token.ToString(), "yyyy-MM-dd HH:mm:ss UTC", CultureInfo.InvariantCulture, | ||
DateTimeStyles.AdjustToUniversal, out dateTime)) // try parsing as utc string. | ||
return dateTime.ToUnixTimestamp(); | ||
|
||
return existingValue; // return the default value. | ||
} | ||
|
||
public override bool CanConvert(Type objectType) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"name": "Peercoin", | ||
"symbol": "PPC", | ||
"algorithm": "sha256" | ||
"algorithm": "sha256", | ||
"reward": "pos" | ||
} |