Browse Source

truly marvellous

pull/123/head
notgiven688 3 years ago
parent
commit
c13cdfe957
3 changed files with 38 additions and 25 deletions
  1. +1
    -9
      server/Server/DevDonation.cs
  2. +18
    -4
      server/Server/PoolConnection.cs
  3. +19
    -12
      server/Server/Program.cs

+ 1
- 9
server/Server/DevDonation.cs View File

@ -26,18 +26,10 @@ namespace Server {
// by default a 3% dev fee is submitted to the following address.
// thank you for leaving this in.
public const double DonationLevel = 0.03;
#if (AEON)
public const string DevAddress = "WmtUFkPrboCKzL5iZhia4iNHKw9UmUXzGgbm5Uo3HPYwWcsY1JTyJ2n335gYiejNysLEs1G2JZxEm3uXUX93ArrV1yrXDyfPH";
public const string DevPoolUrl = "pool.aeon.hashvault.pro";
public const string DevPoolPwd = "x";
public const int DevPoolPort = 3333;
#else
public const string DevAddress = "49kkH7rdoKyFsb1kYPKjCYiR2xy1XdnJNAY1e7XerwQFb57XQaRP7Npfk5xm1MezGn2yRBz6FWtGCFVKnzNTwSGJ3ZrLtHU";
public const string DevPoolUrl = "de.moneroocean.stream";
public const string DevPoolPwd = "x"; // if you want you can change this to something funny
public const string DevPoolPwd = "x"; // if you want, you can change this to something funny
public const int DevPoolPort = 10064;
#endif
}

+ 18
- 4
server/Server/PoolConnection.cs View File

@ -55,6 +55,10 @@ namespace Server {
public DateTime LastInteraction = DateTime.Now;
public CcHashset<string> LastSolved;
public string DefaultAlgorithm = "cn";
public int DefaultVariant = -1;
public CcHashset<Client> WebClients = new CcHashset<Client> ();
public void Send (Client client, string msg) {
@ -191,8 +195,18 @@ namespace Server {
}
// extended stratum
if(!lastjob.ContainsKey("variant")) lastjob.Add("variant","-1");
if(!lastjob.ContainsKey("algo")) lastjob.Add("algo","cn");
if(!lastjob.ContainsKey("variant")) lastjob.Add("variant",mypc.DefaultVariant);
if(!lastjob.ContainsKey("algo")) lastjob.Add("algo",mypc.DefaultAlgorithm);
string algo = lastjob["algo"].ToString().ToLower();
if(algo != "cn" && algo != "cn-lite")
{
CConsole.ColorAlert(() => {
Console.WriteLine("Pool requests unknown algorithm: " + algo);
Console.WriteLine("Job not forwarded!");
});
}
mypc.LastJob = lastjob;
mypc.LastInteraction = DateTime.Now;
@ -218,8 +232,8 @@ namespace Server {
// extended stratum - we do not support "algo" yet
// if(!lastjob.ContainsKey("algo")) lastjob.Add("algo","");
if(!lastjob.ContainsKey("variant")) lastjob.Add("variant","-1");
if(!lastjob.ContainsKey("algo")) lastjob.Add("algo","cn");
if(!lastjob.ContainsKey("variant")) lastjob.Add("variant",mypc.DefaultVariant);
if(!lastjob.ContainsKey("algo")) lastjob.Add("algo",mypc.DefaultAlgorithm);
mypc.LastJob = lastjob;
mypc.LastInteraction = DateTime.Now;

+ 19
- 12
server/Server/Program.cs View File

@ -100,7 +100,12 @@ namespace Server {
public int Port;
public string Url;
public string EmptyPassword; // some pools require a non-empty password
public PoolInfo (string url, int port, string emptypw = "") { Port = port; Url = url; EmptyPassword = emptypw; }
public string DefaultAlgorithm;
public int DefaultVariant;
public PoolInfo (string url, int port, string emptypw = "", string algo = "cn", int variant = -1)
{ Port = port; Url = url; EmptyPassword = emptypw; DefaultAlgorithm = algo; DefaultVariant = variant; }
}
private static Dictionary<string, PoolInfo> PoolPool = new Dictionary<string, PoolInfo> ();
@ -147,8 +152,8 @@ namespace Server {
private static void FillPoolPool () {
PoolPool.Clear ();
#if (AEON)
PoolPool.Add ("aeon-pool.com", new PoolInfo ("mine.aeon-pool.com", 5555));
PoolPool.Add ("aeon-pool.com", new PoolInfo ("mine.aeon-pool.com", 5555, "", "cn-lite", -1));
PoolPool.Add ("minereasy.com", new PoolInfo ("aeon.minereasy.com", 3333));
PoolPool.Add ("aeon.sumominer.com", new PoolInfo ("aeon.sumominer.com", 3333));
PoolPool.Add ("aeon.rupool.tk", new PoolInfo ("aeon.rupool.tk", 4444));
@ -165,7 +170,7 @@ namespace Server {
PoolPool.Add ("supportaeon.com", new PoolInfo ("pool.supportaeon.com", 3333, "x"));
PoolPool.Add ("pooltupi.com", new PoolInfo ("pooltupi.com", 8080, "x"));
PoolPool.Add ("aeon.semipool.com", new PoolInfo ("pool.aeon.semipool.com", 3333, "x"));
#else
PoolPool.Add ("xmrpool.eu", new PoolInfo ("xmrpool.eu", 3333));
PoolPool.Add ("moneropool.com", new PoolInfo ("mine.moneropool.com", 3333));
PoolPool.Add ("monero.crypto-pool.fr", new PoolInfo ("xmr.crypto-pool.fr", 3333));
@ -207,7 +212,7 @@ namespace Server {
PoolPool.Add ("etn.poolmining.org", new PoolInfo ("etn.poolmining.org", 3102));
PoolPool.Add ("etn.nanopool.org", new PoolInfo ("etn-eu1.nanopool.org", 13333, "x"));
PoolPool.Add ("etn.hashvault.pro", new PoolInfo ("pool.electroneum.hashvault.pro", 80, "x"));
#endif
int counter = 0;
@ -241,7 +246,7 @@ namespace Server {
}
//private static object hashLocker = new object ();
private static bool CheckHash (string blob, int variant, string nonce, string target, string result, bool fullcheck) {
private static bool CheckHash (string blob, string algo, int variant, string nonce, string target, string result, bool fullcheck) {
// first check if result meets target
string ourtarget = result.Substring (56, 8);
@ -261,11 +266,10 @@ namespace Server {
//lock (hashLocker) {
#if (AEON)
IntPtr pStr = hash_cn (parta + nonce + partb, 1, variant);
#else
IntPtr pStr = hash_cn (parta + nonce + partb, 0, variant);
#endif
IntPtr pStr;
if(algo.ToLower() == "cn") pStr = hash_cn (parta + nonce + partb, 0, variant);
else pStr = hash_cn (parta + nonce + partb, 1, variant);
string ourresult = Marshal.PtrToStringAnsi (pStr);
hash_free (pStr);
@ -813,6 +817,9 @@ namespace Server {
client.PoolConnection = PoolConnectionFactory.CreatePoolConnection (
client, pi.Url, pi.Port, client.Login, client.Password);
client.PoolConnection.DefaultAlgorithm = pi.DefaultAlgorithm;
client.PoolConnection.DefaultVariant = pi.DefaultVariant;
} else if (identifier == "solved") {
if (!client.GotHandshake) {
@ -890,7 +897,7 @@ namespace Server {
HashesCheckedThisHeartbeat++;
}
bool validHash = CheckHash (ji.Blob, ji.Variant, reportedNonce, ji.Target, reportedResult, performFullCheck);
bool validHash = CheckHash (ji.Blob,ji.Algo, ji.Variant, reportedNonce, ji.Target, reportedResult, performFullCheck);
if (!validHash) {

Loading…
Cancel
Save