コード例 #1
0
        public void OracleTestWithTooMuchData()
        {
            var owner  = PhantasmaKeys.Generate();
            var wallet = PhantasmaKeys.Generate();
            var nexus  = new Nexus("simnet", null, null);

            nexus.SetOracleReader(new OracleSimulator(nexus));
            var simulator = new NexusSimulator(nexus, owner, 1234);

            for (int i = 0; i < DomainSettings.MaxOracleEntriesPerBlock + 1; i++)
            {
                var url    = DomainExtensions.GetOracleBlockURL("neo", "neo", new BigInteger(i));
                var iBlock = nexus.GetOracleReader().Read <InteropBlock>(DateTime.Now, url);
            }

            Assert.ThrowsException <ChainException>(() =>
            {
                simulator.BeginBlock();
                simulator.GenerateTransfer(owner, wallet.Address, nexus.RootChain, "SOUL", 100);
                simulator.EndBlock().First();
            });
        }
コード例 #2
0
        public void OracleTestWithData()
        {
            var owner  = PhantasmaKeys.Generate();
            var wallet = PhantasmaKeys.Generate();
            var nexus  = new Nexus("simnet", null, null);

            nexus.SetOracleReader(new OracleSimulator(nexus));
            var simulator = new NexusSimulator(nexus, owner, 1234);

            //for (var i = 0; i < 65536; i++)
            for (var i = 0; i < 100; i++)
            {
                var url    = DomainExtensions.GetOracleBlockURL("neo", "neo", new BigInteger(i));
                var iBlock = nexus.GetOracleReader().Read <InteropBlock>(DateTime.Now, url);
            }

            simulator.BeginBlock();
            simulator.GenerateTransfer(owner, wallet.Address, nexus.RootChain, "SOUL", 100);
            var block = simulator.EndBlock().First();

            Console.WriteLine("block oracle data: " + block.OracleData.Count());
            Assert.IsTrue(block.OracleData.Count() == 100);
        }