Example #1
0
        // 根据链的Hash,获取LocalNode对象
        public LocalNode GetLocalNode(UInt160 chainHash)
        {
            if (chainHash.Equals(UInt160.Zero))
            {
                return(LocalNode.Root);
            }
            else
            {
                if (appLocalNodes.TryGetValue(chainHash, out LocalNode localNode))
                {
                    return(localNode);
                }
            }

            return(null);
        }
Example #2
0
        // 根据链的Hash,获取ZoroSystem对象
        public ZoroSystem GetZoroSystem(UInt160 chainHash)
        {
            if (chainHash.Equals(UInt160.Zero))
            {
                return(ZoroSystem.Root);
            }
            else
            {
                if (appSystems.TryGetValue(chainHash, out ZoroSystem chain))
                {
                    return(chain);
                }
            }

            return(null);
        }
Example #3
0
        // 根据链的Hash,获取区块链对象
        public Blockchain GetBlockchain(UInt160 chainHash)
        {
            if (chainHash.Equals(UInt160.Zero))
            {
                return(Blockchain.Root);
            }
            else
            {
                if (appBlockchains.TryGetValue(chainHash, out Blockchain blockchain))
                {
                    return(blockchain);
                }
            }

            return(null);
        }
Example #4
0
        public ZoroSystem(Store store, UInt160 chainHash)
        {
            ChainHash = chainHash;

            if (chainHash.Equals(UInt160.Zero))
            {
                if (root != null)
                {
                    throw new InvalidOperationException();
                }

                root = this;
            }
            else
            {
                ZoroChainSystem.Singleton.RegisterAppSystem(chainHash, this);
            }

            Blockchain  = Context.ActorOf(Ledger.Blockchain.Props(this, store, chainHash), "Blockchain");
            LocalNode   = Context.ActorOf(Network.P2P.LocalNode.Props(this, chainHash), "LocalNode");
            TaskManager = Context.ActorOf(Network.P2P.TaskManager.Props(this, chainHash), "TaskManager");
        }