Ejemplo n.º 1
0
 public static bool gobject_submit(bool fTestNet, string sID, int nProposalTimeStamp, string sHex, string sPrepareTXID)
 {
     try
     {
         if (sPrepareTXID == "")
         {
             return(false);
         }
         // Submit the gobject to the network - gobject submit parenthash revision time datahex collateraltxid
         string   sArgs   = "0 1 " + nProposalTimeStamp.ToString() + " " + sHex + " " + sPrepareTXID;
         string   sCmd1   = "gobject submit " + sArgs;
         object[] oParams = new object[6];
         oParams[0] = "submit";
         oParams[1] = "0";
         oParams[2] = "1";
         oParams[3] = nProposalTimeStamp.ToString();
         oParams[4] = sHex;
         oParams[5] = sPrepareTXID;
         NBitcoin.RPC.RPCClient n = fTestNet ? WebRPC.GetTestNetRPCClient() : WebRPC.GetLocalRPCClient();
         dynamic oOut             = n.SendCommand("gobject", oParams);
         string  sSubmitTXID      = oOut.Result.ToString();
         if (sSubmitTXID.Length > 20)
         {
             // Update the record allowing us to know this has been submitted
             string sql = "Update Proposal set Submitted=GetDate(),SubmitTXID='" + sSubmitTXID + "' where id = '" + sID + "'";
             Common.gData.Exec(sql);
             return(true);
         }
         return(false);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Ejemplo n.º 2
0
        public static void SyncFastlyNicknames()
        {
            try
            {
                string   path      = GetFolderUnchained("nicknames.dat");
                DateTime diMod     = System.IO.File.GetLastWriteTime(path);
                TimeSpan tsElapsed = System.DateTime.Now - diMod;
                if (dicNicknames.Count() == 0)
                {
                    MemorizeNickNames();
                }

                if (tsElapsed.TotalSeconds < (60 * 30))
                {
                    return;
                }

                NBitcoin.RPC.RPCClient c = WebRPC.GetLocalRPCClient();
                object[] oParams         = new object[2];
                oParams[0] = "cpk";
                oParams[1] = "9999999";

                dynamic j    = c.SendCommand("datalist", oParams);
                JObject j1   = j.Result;
                JArray  ja   = (JArray)j.Result.ChildrenTokens;
                string  data = "";

                foreach (var jcpk in j1)
                {
                    string skey    = jcpk.Key;
                    string sValue  = jcpk.Value.ToString();
                    string sType   = GetEle(skey, "[-]", 0);
                    string sPriKey = GetEle(skey, "[-]", 1);
                    string sCPK    = GetEle(sValue, "|", 0);
                    string sNN     = GetEle(sValue, "|", 1);
                    if (sType == "CPK" && sCPK != "" && sNN != "")
                    {
                        string sRow = sType + "|" + sCPK + "|" + sNN + "\r\n";
                        data += sRow;
                    }
                }

                Unchained.WriteToFile(path, data);
                MemorizeNickNames();
            }
            catch (Exception ex)
            {
                Log("SyncFastlyNicknames " + ex.Message);
            }
        }
Ejemplo n.º 3
0
        public static void gobject_prepare(bool fTestNet, string sID, int StartTimeStamp, string sHex)
        {
            // gobject prepare
            string sArgs = "0 1 " + StartTimeStamp.ToString() + " " + sHex;
            string sCmd1 = "gobject prepare " + sArgs;

            object[] oParams = new object[5];
            oParams[0] = "prepare";
            oParams[1] = "0";
            oParams[2] = "1";
            oParams[3] = StartTimeStamp.ToString();
            oParams[4] = sHex;

            NBitcoin.RPC.RPCClient n = fTestNet ? WebRPC.GetTestNetRPCClient() : WebRPC.GetLocalRPCClient();

            dynamic oOut         = n.SendCommand("gobject", oParams);
            string  sPrepareTXID = oOut.Result.ToString();

            string sql4 = "Update Proposal Set PrepareTxId='" +
                          sPrepareTXID + "',Updated=getdate() where id = '"
                          + sID + "'";

            Common.gData.Exec(sql4);
        }