static Stratum.Response.MiningSubscribe MakeSubscribe(ReplicationData.Subscribe repl) { var nonce1 = HexHelp.DecodeHex(repl.extraNonce1); var nonce2sz = GoodNonce2SizeOrThrow(repl.nonce2sz); return(new Stratum.Response.MiningSubscribe("abcdef0123456789", nonce1, nonce2sz)); }
static Stratum.Notification.NewJob MakeJob(ReplicationData.Job repl) { var jobid = "abcd"; var cbHead = HexHelp.DecodeHex(repl.cbHead); var cbTail = HexHelp.DecodeHex(repl.cbTail); var parsedMerkle = DecodeMerkles(repl.merkles); var bver = HexHelp.DecodeHex(repl.blockVersion); var ndiff = HexHelp.DecodeHex(repl.networkDiff); var ntime = HexHelp.DecodeHex(repl.networkTime); var res = new Stratum.Notification.NewJob(jobid, bver, null, cbHead, cbTail, ndiff, ntime, true); HexHelp.DecodeInto(res.prevBlock.blob, repl.prevHash); res.merkles.AddRange(parsedMerkle); return(res); }
public void BytesComeInStringOrder(string hex, byte[] expected) { Assert.Equal(expected, HexHelp.DecodeHex(hex)); }
public void HexStringsMustHaveEvenLength(string hex) { Assert.Throws <BadParseException>(() => HexHelp.DecodeHex(hex)); }
public void HexStringCannotBeEmpty() { Assert.Throws <BadParseException>(() => HexHelp.DecodeHex("")); }