Ejemplo n.º 1
0
        public IRpcMethodResult AddMiningPool(string name, string publicKey, string signature)
        {
            try
            {
                var miningPoolComponent = new MiningPoolComponent();
                if (miningPoolComponent.HasMiningPool(name, publicKey))
                {
                    throw new CommonException(ErrorCode.Engine.Block.Verify.MINING_POOL_EXISTED);
                }

                var miningMsg = new MiningMsg()
                {
                    Name = name, PublicKey = publicKey, Signature = signature
                };
                var result = miningPoolComponent.AddMiningToPool(miningMsg);
                return(Ok(result));
            }
            catch (CommonException ce)
            {
                return(Error(ce.ErrorCode, ce.Message, ce));
            }
            catch (Exception ex)
            {
                return(Error(ErrorCode.UNKNOWN_ERROR, ex.Message, ex));
            }
        }
Ejemplo n.º 2
0
 public IRpcMethodResult AddMiningPool(string name, string publicKey, string signature)
 {
     try
     {
         var miningMsg = new MiningMsg()
         {
             Name = name, PublicKey = publicKey, Signature = signature
         };
         var miningPoolComponent = new MiningPoolComponent();
         var result = miningPoolComponent.AddMiningToPool(miningMsg);
         return(Ok(result));
     }
     catch (CommonException ce)
     {
         return(Error(ce.ErrorCode, ce.Message, ce));
     }
     catch (Exception ex)
     {
         return(Error(ErrorCode.UNKNOWN_ERROR, ex.Message, ex));
     }
 }