Exemple #1
0
        public DataChain(int chainId, uint chainIndex, Node.Node node, CoreChain coreChain, ServiceChain serviceChain, ChainKeyStore keyStore, int attachementKey) : base(ChainType.Data, chainId, chainIndex, node)
        {
            _coreChain    = coreChain;
            _serviceChain = serviceChain;
            Attachements  = node.AttachementManager;

            ChainKeyIndex = keyStore.KeyIndex;
            ChainKey      = keyStore.DecryptedKey;
            KeyStore      = keyStore;

            AttachementKey = attachementKey;

            var endPoints = new HashSet <AvailableEndPoint>();

            var chainInfo = _coreChain.GetChainInfo(ChainId);

            if (chainInfo != null)
            {
                var cep = chainInfo.GetPublicEndpoints();
                foreach (var ep in cep)
                {
                    var e = new Uri(ep);
                    if (IsValidAvailableEndPoint(e))
                    {
                        endPoints.Add(new AvailableEndPoint(e));
                    }
                }
            }

            AvailableEndpoints = new List <AvailableEndPoint>(endPoints);
        }
        public ServiceChain(int chainId, Node.Node node, CoreChain coreChain, ChainKeyStore keyStore) : base(ChainType.Service, chainId, 0, node)
        {
            CoreChain = coreChain;

            var endPoints = new HashSet <AvailableEndPoint>();

            _chainKeyIndex = keyStore.KeyIndex;
            _chainKey      = keyStore.DecryptedKey;
            KeyStore       = keyStore;

            var chainInfo = CoreChain.GetChainInfo(ChainId);

            if (chainInfo != null)
            {
                var cep = chainInfo.GetPublicEndpoints();
                foreach (var ep in cep)
                {
                    var e = new Uri(ep);
                    if (IsValidAvailableEndPoint(e))
                    {
                        endPoints.Add(new AvailableEndPoint(e));
                    }
                }
            }

            AvailableEndpoints = new List <AvailableEndPoint>(endPoints);
        }
Exemple #3
0
 public SyncManager(Node.Node node)
 {
     _pubSub        = node.PubSub;
     _chainManager  = node.ChainManager;
     _coreChain     = _chainManager.CoreChain;
     _storage       = node.Storage;
     _configuration = node.NodeConfiguration;
     _host          = node.Host;
 }
        public CoreBlockGenerator(CoreChain coreChain, CoreBlock lastBlock)
        {
            _coreChain  = coreChain;
            _lastBlock  = lastBlock;
            _blockState = coreChain.GetChainInfo(Protocol.CoreChainId).LastState;

            NextAccountId = lastBlock.NextAccountId;
            NextChainId   = lastBlock.NextChainId;
        }
        public ServiceBlockGenerator(CoreChain coreChain, ServiceChain serviceChain, MaintainChain maintainChain, ServiceBlock lastBlock)
        {
            ChainId = serviceChain.ChainId;

            _blockInfo     = new ServiceBlockInfo(serviceChain);
            _coreChain     = coreChain;
            _serviceChain  = serviceChain;
            _maintainChain = maintainChain;
            _lastBlock     = lastBlock;
            _chainInfo     = coreChain.GetChainInfo(ChainId);
            _blockState    = _chainInfo.LastState;
        }
Exemple #6
0
        protected Council(Node.Node node, ChainType chainType, int chainId, uint chainIndex, short keyIndex, Key key)
        {
            ChainType  = chainType;
            ChainId    = chainId;
            ChainIndex = chainIndex;

            RequiresChainVoteKeyFlags = Block.GetRequiredChainVoteKeyFlags(ChainType);
            RequiresChainKeyFlags     = Block.GetRequiredChainKeyFlags(ChainType);
            LocalKeyIndex             = keyIndex;
            _localKey = key;

            _node         = node;
            _coreChain    = node.ChainManager.CoreChain;
            _blockStorage = node.ChainManager.GetChain(ChainType, ChainId, chainIndex).BlockStorage;
        }
 public CouncilManager(Node.Node node)
 {
     _node      = node;
     _coreChain = node.ChainManager.CoreChain;
     _nodeInfo  = _node.NodeConfiguration.LocaleNodeInfo;
 }