Example #1
0
 public void StartConsensus(Wallet wallet, Store consensus_store = null, bool ignoreRecoveryLogs = false)
 {
     Consensus = ActorSystem.ActorOf(ConsensusService.Props(this.LocalNode, this.TaskManager, consensus_store ?? store, wallet));
     Consensus.Tell(new ConsensusService.Start {
         IgnoreRecoveryLogs = ignoreRecoveryLogs
     }, Blockchain);
 }
Example #2
0
        /*
         * public void StartConsensus(Wallet wallet, Store consensus_store = null, bool ignoreRecoveryLogs = false)
         * {
         *  Consensus = ActorSystem.ActorOf(ConsensusService.Props(this.LocalNode, this.TaskManager, consensus_store ?? store, wallet));
         *  Consensus.Tell(new ConsensusService.Start { IgnoreRecoveryLogs = ignoreRecoveryLogs }, Blockchain);
         * }
         */

        /// <summary>
        /// By BHP
        /// </summary>
        /// <param name="wallet"></param>
        public void StartConsensus(Wallet wallet, Store consensus_store = null, bool ignoreRecoveryLogs = false)
        {
            bool found = false;

            foreach (WalletAccount account in wallet.GetAccounts())
            {
                string publicKey = account.GetKey().PublicKey.EncodePoint(true).ToHexString();
                foreach (ECPoint point in Ledger.Blockchain.StandbyValidators)
                {
                    string validator = point.EncodePoint(true).ToHexString();
                    if (validator.Equals(publicKey))
                    {
                        found = true;
                        break;
                    }
                }
                if (found)
                {
                    break;
                }
            }
            //只有共识节点才能开启共识
            if (found)
            {
                Consensus = ActorSystem.ActorOf(ConsensusService.Props(this.LocalNode, this.TaskManager, consensus_store ?? store, wallet));
                Consensus.Tell(new ConsensusService.Start {
                    IgnoreRecoveryLogs = ignoreRecoveryLogs
                }, Blockchain);
            }
        }
Example #3
0
        /*
         * public void StartConsensus(Wallet wallet)
         * {
         *  Consensus = ActorSystem.ActorOf(ConsensusService.Props(this.LocalNode, this.TaskManager, wallet));
         *  Consensus.Tell(new ConsensusService.Start());
         * }
         */

        /// <summary>
        /// By BHP
        /// </summary>
        /// <param name="wallet"></param>
        public void StartConsensus(Wallet wallet)
        {
            bool found = false;

            foreach (WalletAccount account in wallet.GetAccounts())
            {
                string publicKey = account.GetKey().PublicKey.EncodePoint(true).ToHexString();
                foreach (ECPoint point in Ledger.Blockchain.StandbyValidators)
                {
                    string validator = point.EncodePoint(true).ToHexString();
                    if (validator.Equals(publicKey))
                    {
                        found = true;
                        break;
                    }
                }
                if (found)
                {
                    break;
                }
            }
            //只有共识节点才能开启共识
            if (found)
            {
                Consensus = ActorSystem.ActorOf(ConsensusService.Props(LocalNode, TaskManager, wallet));
                Consensus.Tell(new ConsensusService.Start());
            }
        }
Example #4
0
 private void _StartConsensus(Wallet wallet)
 {
     if (Consensus == null)
     {
         Consensus = Context.ActorOf(ConsensusService.Props(LocalNode, TaskManager, wallet, ChainHash), $"ConsensusService");
         Consensus.Tell(new ConsensusService.Start());
     }
 }
Example #5
0
 public void StartConsensus(Wallet wallet)
 {
     Consensus = ActorSystem.ActorOf(ConsensusService.Props(this, wallet));
     Consensus.Tell(new ConsensusService.Start());
 }
Example #6
0
 public void StartConsensus()
 {
     Consensus = ActorSystem.ActorOf(ConsensusService.Props(this.LocalNode));
     //Consensus.Tell(new ConsensusService.Start { IgnoreRecoveryLogs = ignoreRecoveryLogs }, Blockchain);
 }
Example #7
0
 public void StartConsensus(Wallet wallet)
 {
     Consensus = ActorSystem.ActorOf(ConsensusService.Props(this.LocalNode, this.TaskManager, wallet));
     Consensus.Tell(new ConsensusService.Start());
 }
Example #8
0
 public void StartConsensus(UInt160 chainHash, Wallet wallet)
 {
     Consensus = ActorSystem.ActorOf(ConsensusService.Props(this, wallet, chainHash));
     Consensus.Tell(new ConsensusService.Start());
 }
 public void StartConsensus()
 {
     Consensus = ActorSystem.ActorOf(ConsensusService.Props(this, this._hostEnv, this._hub, this.LocalNode, TheBlockchain));
     Consensus.Tell(new ConsensusService.Startup {
     }, TheBlockchain);
 }