예제 #1
0
        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));
        }
예제 #2
0
        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);
        }
예제 #3
0
 public void BytesComeInStringOrder(string hex, byte[] expected)
 {
     Assert.Equal(expected, HexHelp.DecodeHex(hex));
 }
예제 #4
0
 public void HexStringsMustHaveEvenLength(string hex)
 {
     Assert.Throws <BadParseException>(() => HexHelp.DecodeHex(hex));
 }
예제 #5
0
 public void HexStringCannotBeEmpty()
 {
     Assert.Throws <BadParseException>(() => HexHelp.DecodeHex(""));
 }