Пример #1
0
        private ApiTests.TestData CreateAPI(bool useMempool = true)
        {
            var owner   = PhantasmaKeys.FromWIF(testWIF);
            var sim     = new NexusSimulator(owner, 1234);
            var mempool = useMempool ? new Mempool(sim.Nexus, 2, 1, System.Text.Encoding.UTF8.GetBytes("TEST")) : null;

            mempool.SetKeys(owner);
            var node = useMempool ? new Node("relay node", sim.Nexus, mempool, owner, 7073, PeerCaps.None, new List <string>()
            {
                "192.168.0.1:7073"
            }, null) : null;
            var api = useMempool ? new NexusAPI(sim.Nexus) : null;

            if (api != null)
            {
                api.Mempool = mempool;
                api.Node    = node;
            }

            var data = new ApiTests.TestData()
            {
                owner     = owner,
                simulator = sim,
                nexus     = sim.Nexus,
                api       = api
            };

            mempool?.Start();

            return(data);
        }
Пример #2
0
        private ApiTests.TestData CreateAPI(bool useMempool = true)
        {
            var owner = PhantasmaKeys.FromWIF(testWIF);
            var nexus = new Nexus("simnet", null, null);

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

            var mempool = useMempool ? new Mempool(sim.Nexus, 2, 1, System.Text.Encoding.UTF8.GetBytes("TEST")) : null;

            mempool.SetKeys(owner);
            var node = useMempool ? new Node("relay node", sim.Nexus, mempool, owner, "localhost", 7073, PeerCaps.Relay | PeerCaps.Mempool, new List <string>()
            {
                "tcp:localhost:7073"
            }, null) : null;
            var api = useMempool ? new NexusAPI(sim.Nexus) : null;

            if (api != null)
            {
                api.Mempool = mempool;
                api.Node    = node;
            }

            var data = new ApiTests.TestData()
            {
                owner     = owner,
                simulator = sim,
                nexus     = sim.Nexus,
                api       = api
            };

            mempool?.StartInThread();

            return(data);
        }
Пример #3
0
        private ApiTests.TestData CreateAPI(bool useMempool = true)
        {
            var owner   = KeyPair.FromWIF(testWIF);
            var sim     = new NexusSimulator(owner, 1234);
            var mempool = useMempool ? new Mempool(owner, sim.Nexus, 2, 1) : null;
            var node    = useMempool ? new Node(sim.Nexus, mempool, owner, 7073, PeerCaps.None, new List <string>()
            {
                "192.168.0.1:7073"
            }, null) : null;
            var api = useMempool ? new NexusAPI(sim.Nexus, mempool, node) : null;

            var data = new ApiTests.TestData()
            {
                owner     = owner,
                simulator = sim,
                nexus     = sim.Nexus,
                api       = api
            };

            mempool?.Start();

            return(data);
        }