Ejemplo n.º 1
0
        public void SubscribeReplyMustHaveMiningNotify()
        {
            var dummyReply = "[[[\"mining.set_difficulty\",\"deadbeefcafebabecffd010000000000\"]],\"0800c0ff\",4]";
            var uglee      = JsonConvert.DeserializeObject <Newtonsoft.Json.Linq.JArray>(dummyReply);

            Assert.Throws <MissingRequiredException>(() => ResponseParser.MiningSubscribe(uglee));
        }
Ejemplo n.º 2
0
        public void SubscribeReplyExtra2SzMustBe4() // ok really, I'm taking it easy for the time being. Even though bigger nonces might be useful in the future.
        {
            var bruh  = "[[[\"mining.set_difficulty\",\"deadbeefcafebabecffd010000000000\"],[\"mining.notify\",\"deadbeefcafebabecffd010000000000\"]],\"0800c0ff\",8]";
            var uglee = JsonConvert.DeserializeObject <Newtonsoft.Json.Linq.JArray>(bruh);

            Assert.Throws <BadParseException>(() => ResponseParser.MiningSubscribe(uglee));
        }
Ejemplo n.º 3
0
        public void SubscribeReplyExtra2SzMustBePositive()
        {
            var bruh  = "[[[\"mining.set_difficulty\",\"deadbeefcafebabecffd010000000000\"],[\"mining.notify\",\"deadbeefcafebabecffd010000000000\"]],\"0800c0ff\",-1]";
            var uglee = JsonConvert.DeserializeObject <Newtonsoft.Json.Linq.JArray>(bruh);

            Assert.Throws <BadParseException>(() => ResponseParser.MiningSubscribe(uglee));
        }
Ejemplo n.º 4
0
        public void SubscribeReplyExtranonceCanHaveDifferentLengths(string dummyReply, string sessionId, byte[] extraNonce1, int extraNonce2sz)
        {
            var uglee    = JsonConvert.DeserializeObject <Newtonsoft.Json.Linq.JArray>(dummyReply);
            var response = ResponseParser.MiningSubscribe(uglee);

            Assert.Equal(sessionId, response.sessionId);
            Assert.Equal(extraNonce1, response.extraNonceOne);
            Assert.Equal(extraNonce2sz, response.extraNonceTwoByteCount);
        }
Ejemplo n.º 5
0
        public void ParsingGoodSubscribeReply(string dummyReply, string sessionId, byte[] extraNonce1, int extraNonce2sz)
        {
            // That's how it comes out from the parsing. I don't like it at all but that's it.
            var uglee    = JsonConvert.DeserializeObject <Newtonsoft.Json.Linq.JArray>(dummyReply);
            var response = ResponseParser.MiningSubscribe(uglee);

            Assert.Equal(sessionId, response.sessionId);
            Assert.Equal(extraNonce1, response.extraNonceOne);
            Assert.Equal(extraNonce2sz, response.extraNonceTwoByteCount);
        }
Ejemplo n.º 6
0
        public void SubscribeReplyExtranonceMustBeNonempty(string dummyReply)
        {
            var uglee = JsonConvert.DeserializeObject <Newtonsoft.Json.Linq.JArray>(dummyReply);

            Assert.Throws <MissingRequiredException>(() => ResponseParser.MiningSubscribe(uglee));
        }
Ejemplo n.º 7
0
        public void SubscribeReplyExtranonceMustBeIntegralHex(string dummyReply)
        {
            var uglee = JsonConvert.DeserializeObject <Newtonsoft.Json.Linq.JArray>(dummyReply);

            Assert.Throws <BadParseException>(() => ResponseParser.MiningSubscribe(uglee));
        }