diff --git a/configure.ac b/configure.ac index c609f99..7d25e84 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 9) define(_CLIENT_VERSION_REVISION, 2) define(_CLIENT_VERSION_BUILD, 1) -define(_CLIENT_VERSION_IS_RELEASE, true) +define(_CLIENT_VERSION_IS_RELEASE, false) define(_COPYRIGHT_YEAR, 2014) AC_INIT([IXCoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@bitcoin.org],[ixcoin]) AC_CONFIG_AUX_DIR([src/build-aux]) diff --git a/contrib/linearize/linearize.py b/contrib/linearize/linearize.py index e913214..91cf323 100644 --- a/contrib/linearize/linearize.py +++ b/contrib/linearize/linearize.py @@ -8,15 +8,18 @@ # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # -# A really nice aspect to this version of the linearizer, which builds your bootstrap.dat file, is that no -# knowledge of the particulars about any given coin are required. Only that it responds on the correct port -# to getblockhash() and getblock() requests. So it does require you have a working and running coin daemon -# such as ixcoind.exe or ixcoin-qt -server or bitcoind.exe or whatever xcoind.exe you care to use. +# A really nice aspect to this version of the linearizer, which builds your bootstrap.dat file, +# is that NO knowledge of the particulars about any given coin are required. Only that it +# responds on the correct port to getblockhash() and getblock() requests. # -# NOTE: 9/17/2014 - This code has been ported & now runs within Python 3+ environments, originally coded for Python 2 -# for bitcoin, and has now been upgraded for use with Ixcoin builds & releases. -# Allot of work 'needs' to be done, in order to have even the most elementary error handling. -# However, once setup correctly it will get the job done! +# It DOES require you have a working and running coin daemon such as ixcoind.exe or +# ixcoin-qt -server or bitcoind.exe or whatever xyzcoind.exe you care to use. +# +# NOTE: 9/17/2014 - +# This code has been ported & now runs within Python 3+ environments, originally coded +# for Python 2 in bitcoin, it has now been upgraded for use with Ixcoin builds & releases. +# Allot of work 'needs' to be done, in order to have even the most elementary +# of error handling. However, once setup correctly, it will get the job done! # import json @@ -138,7 +141,7 @@ def get_blocks(settings): # As we still have 20+ days to go, this would generate an error and must be reduced until then. if 'max_height' not in settings: # settings['max_height'] = 227499 - settings['max_height'] = 223240 + settings['max_height'] = 225365 if 'rpcuser' not in settings or 'rpcpassword' not in settings: print("Missing username and/or password in cfg file") sys.exit(1) diff --git a/doc/README_windows.txt b/doc/README_windows.txt index 2bb441c..bd05c11 100644 --- a/doc/README_windows.txt +++ b/doc/README_windows.txt @@ -1,4 +1,4 @@ -IXCoin 0.9.2 BETA +IXCoin 0.9.2.1 Pre-Release Test Build Copyright (c) 2011-2014 IXCoin Core Developers @@ -19,12 +19,22 @@ with each other, with the help of a P2P network to check for double-spending. Setup ----- -Unpack the files into a directory and run ixcoin-qt.exe. - -IXCoin Core is the original IXCoin client and it builds the backbone of the network. -However, it downloads and stores the entire history of IXCoin transactions; -depending on the speed of your computer and network connection, the synchronization -process can take anywhere from a few hours to a day or more. +Either via an ixcoin-win32-setup installer or by manually doing the +following steps, you will need to Unpack the files into a directory and create +a simple set of shortcuts in your START menu, on your desktop or in your toolbar, +in order to run ixcoin-qt.exe whenever you need to use the network. The +installer also adds an uninstaller shortcut to your START menu list. + +IXCoin Core is the updated version of the original IXCoin client, it builds +the backbone of the network, and now has many advanced features. It does +however, need to download and stores the entire history of IXCoin transactions; +depending on the speed of your computer and network connection, that +synchronization process can take anywhere from a few hours to a day or more. +In order to expedite this process, we've created a current bootstrap.dat file, +which when compressed, is a relatively small file of just over 150MB's in +size. For over 3 years/15 weeks of transaction history, that is really small. +Place that in your newly initialized Ixcoin data directory and it will import +nearly all the past transaction history in just a few minutes. As Ixcoin is very similar, the Best source of information can be found on the Bitcoin wiki at: diff --git a/share/pixmaps/ixcoin.ico b/share/pixmaps/ixcoin.ico index f5480f4..0b3aabd 100644 Binary files a/share/pixmaps/ixcoin.ico and b/share/pixmaps/ixcoin.ico differ diff --git a/share/pixmaps/nsis-header.bmp b/share/pixmaps/nsis-header.bmp index 9ab0ce2..3af7938 100644 Binary files a/share/pixmaps/nsis-header.bmp and b/share/pixmaps/nsis-header.bmp differ diff --git a/share/pixmaps/nsis-wizard.bmp b/share/pixmaps/nsis-wizard.bmp index 71255c6..361b372 100644 Binary files a/share/pixmaps/nsis-wizard.bmp and b/share/pixmaps/nsis-wizard.bmp differ diff --git a/share/setup-PathFixes.nsi b/share/setup-PathFixes.nsi new file mode 100644 index 0000000..670c5f6 --- /dev/null +++ b/share/setup-PathFixes.nsi @@ -0,0 +1,179 @@ +Name "IXCoin Core (32-bit)" + +RequestExecutionLevel highest +SetCompressor /SOLID lzma + +# General Symbol Definitions +!define REGKEY "SOFTWARE\$(^Name)" +!define VERSION 0.9.2 +!define COMPANY "IXCoin Core project" +!define URL http://www.ixcoin.org/ + +# MUI Symbol Definitions +!define MUI_ICON "c:\ixcoin-0.9.2.1\share\pixmaps\ixcoin.ico" +!define MUI_WELCOMEFINISHPAGE_BITMAP "c:\ixcoin-0.9.2.1\share\pixmaps\nsis-wizard.bmp" +!define MUI_HEADERIMAGE +!define MUI_HEADERIMAGE_RIGHT +!define MUI_HEADERIMAGE_BITMAP "c:\ixcoin-0.9.2.1\share\pixmaps\nsis-header.bmp" +!define MUI_FINISHPAGE_NOAUTOCLOSE +!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM +!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY} +!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup +!define MUI_STARTMENUPAGE_DEFAULTFOLDER "IXCoin Core" +!define MUI_FINISHPAGE_RUN $INSTDIR\ixcoin-qt.exe +!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" +!define MUI_UNWELCOMEFINISHPAGE_BITMAP "c:\ixcoin-0.9.2.1\share\pixmaps\nsis-wizard.bmp" +!define MUI_UNFINISHPAGE_NOAUTOCLOSE + +# Included files +!include Sections.nsh +!include MUI2.nsh +!if "32" == "64" +!include x64.nsh +!endif + +# Variables +Var StartMenuGroup + +# Installer pages +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES + +# Installer languages +!insertmacro MUI_LANGUAGE English + +# Installer attributes +OutFile c:\ixcoin-0.9.2.1\ixcoin-${VERSION}-win32-setup.exe +!if "32" == "64" +InstallDir $PROGRAMFILES64\IXCoin +!else +InstallDir $PROGRAMFILES\IXCoin +!endif +CRCCheck on +XPStyle on +BrandingText " " +ShowInstDetails show +VIProductVersion ${VERSION}.1 +VIAddVersionKey ProductName "IXCoin Core" +VIAddVersionKey ProductVersion "${VERSION}" +VIAddVersionKey CompanyName "${COMPANY}" +VIAddVersionKey CompanyWebsite "${URL}" +VIAddVersionKey FileVersion "${VERSION}" +VIAddVersionKey FileDescription "" +VIAddVersionKey LegalCopyright "" +InstallDirRegKey HKCU "${REGKEY}" Path +ShowUninstDetails show + +# Installer sections +Section -Main SEC0000 + SetOutPath $INSTDIR + SetOverwrite on + File c:\ixcoin-0.9.2.1\release\ixcoin-qt.exe + File /oname=COPYING.txt c:\ixcoin-0.9.2.1\COPYING + File /oname=readme.txt c:\ixcoin-0.9.2.1\doc\README_windows.txt + SetOutPath $INSTDIR\daemon + File c:\ixcoin-0.9.2.1\release\ixcoind.exe + File c:\ixcoin-0.9.2.1\release\ixcoin-cli.exe + SetOutPath $INSTDIR\doc + File /r c:\ixcoin-0.9.2.1\doc\*.* + SetOutPath $INSTDIR + WriteRegStr HKCU "${REGKEY}\Components" Main 1 + + # Remove old wxwidgets-based-ixcoin executable and locales: + Delete /REBOOTOK $INSTDIR\ixcoin.exe + RMDir /r /REBOOTOK $INSTDIR\locale +SectionEnd + +Section -post SEC0001 + WriteRegStr HKCU "${REGKEY}" Path $INSTDIR + SetOutPath $INSTDIR + WriteUninstaller $INSTDIR\uninstall.exe + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + CreateDirectory $SMPROGRAMS\$StartMenuGroup + CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" $INSTDIR\ixcoin-qt.exe + CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe + !insertmacro MUI_STARTMENU_WRITE_END + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}" + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe + WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe + WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1 + WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1 + WriteRegStr HKCR "ixcoin" "URL Protocol" "" + WriteRegStr HKCR "ixcoin" "" "URL:IXCoin" + WriteRegStr HKCR "ixcoin\DefaultIcon" "" $INSTDIR\ixcoin-qt.exe + WriteRegStr HKCR "ixcoin\shell\open\command" "" '"$INSTDIR\ixcoin-qt.exe" "%1"' +SectionEnd + +# Macro for selecting uninstaller sections +!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID + Push $R0 + ReadRegStr $R0 HKCU "${REGKEY}\Components" "${SECTION_NAME}" + StrCmp $R0 1 0 next${UNSECTION_ID} + !insertmacro SelectSection "${UNSECTION_ID}" + GoTo done${UNSECTION_ID} +next${UNSECTION_ID}: + !insertmacro UnselectSection "${UNSECTION_ID}" +done${UNSECTION_ID}: + Pop $R0 +!macroend + +# Uninstaller sections +Section /o -un.Main UNSEC0000 + Delete /REBOOTOK $INSTDIR\ixcoin-qt.exe + Delete /REBOOTOK $INSTDIR\COPYING.txt + Delete /REBOOTOK $INSTDIR\readme.txt + RMDir /r /REBOOTOK $INSTDIR\daemon + RMDir /r /REBOOTOK $INSTDIR\doc + DeleteRegValue HKCU "${REGKEY}\Components" Main +SectionEnd + +Section -un.post UNSEC0001 + DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" + Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" + Delete /REBOOTOK "$SMSTARTUP\IXCoin.lnk" + Delete /REBOOTOK $INSTDIR\uninstall.exe + Delete /REBOOTOK $INSTDIR\debug.log + Delete /REBOOTOK $INSTDIR\db.log + DeleteRegValue HKCU "${REGKEY}" StartMenuGroup + DeleteRegValue HKCU "${REGKEY}" Path + DeleteRegKey /IfEmpty HKCU "${REGKEY}\Components" + DeleteRegKey /IfEmpty HKCU "${REGKEY}" + DeleteRegKey HKCR "ixcoin" + RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup + RmDir /REBOOTOK $INSTDIR + Push $R0 + StrCpy $R0 $StartMenuGroup 1 + StrCmp $R0 ">" no_smgroup +no_smgroup: + Pop $R0 +SectionEnd + +# Installer functions +Function .onInit + InitPluginsDir +!if "32" == "64" + ${If} ${RunningX64} + ; disable registry redirection (enable access to 64-bit portion of registry) + SetRegView 64 + ${Else} + MessageBox MB_OK|MB_ICONSTOP "Cannot install 64-bit version on a 32-bit system." + Abort + ${EndIf} +!endif +FunctionEnd + +# Uninstaller functions +Function un.onInit + ReadRegStr $INSTDIR HKCU "${REGKEY}" Path + !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup + !insertmacro SELECT_UNSECTION Main ${UNSEC0000} +FunctionEnd diff --git a/src/alert.cpp b/src/alert.cpp index 99164d6..b6599b4 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -204,13 +204,13 @@ bool CAlert::ProcessAlert(bool fThread) const CAlert& alert = (*mi).second; if (Cancels(alert)) { - LogPrint("alert", "cancelling alert %d\n", alert.nID); + LogPrintf( "Cancelling alert %d\n", alert.nID ); uiInterface.NotifyAlertChanged((*mi).first, CT_DELETED); mapAlerts.erase(mi++); } else if (!alert.IsInEffect()) { - LogPrint("alert", "expiring alert %d\n", alert.nID); + LogPrintf( "Expiring alert %d\n", alert.nID ); uiInterface.NotifyAlertChanged((*mi).first, CT_DELETED); mapAlerts.erase(mi++); } @@ -224,7 +224,7 @@ bool CAlert::ProcessAlert(bool fThread) const CAlert& alert = item.second; if (alert.Cancels(*this)) { - LogPrint("alert", "alert already cancelled by %d\n", alert.nID); + LogPrintf( "Alert already cancelled by %d\n", alert.nID ); return false; } } @@ -254,6 +254,6 @@ bool CAlert::ProcessAlert(bool fThread) } } - LogPrint("alert", "accepted alert %d, AppliesToMe()=%d\n", nID, AppliesToMe()); + LogPrintf( "Accepted alert %d, AppliesToMe()=%d\n", nID, AppliesToMe() ); return true; } diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 219f198..efe71bb 100755 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -37,7 +37,14 @@ class CMainParams : public CChainParams { pchMessageStart2[1] = 0xba; pchMessageStart2[2] = 0xb6; pchMessageStart2[3] = 0xdb; - vAlertPubKey = ParseHex("02a9e38d69128d1e9b689a02bb0e67927ef9aff27b62e7b0ecddec2a07ad587ad6"); + // + // Starting with Ixcoin v0.9.2.1, the following vAlertPubKey ECDSA (Ecliptical Curve DSA) hex value will be used + // The private key is not publicly available. This allows only a small group to generate Alert messages on the IXCoin Network: + // As of 9/30/2014 Holders of the private key are: AhmedBodi, GroundRod, several more parties are expected to also be included. + // If an alert is necessary, this can be used to inform all nodes of an important chain development or software upgrade + // + vAlertPubKey = ParseHex("046bcc6984f841c35686e7b9ed7b2ce5b2f4cc8b8a5ef314870e623566f8b8f9d0d7b906c4537c0d5ca55c53b9e2d38834d7c5e5846c50bdced192c105cc83a589"); + nDefaultPort = 8337; nRPCPort = 8338; bnProofOfWorkLimit = CBigNum(~uint256(0) >> 32); @@ -124,9 +131,12 @@ class CTestNetParams : public CMainParams { pchMessageStart[1] = 0xbf; pchMessageStart[2] = 0xb6; pchMessageStart[3] = 0xdb; - vAlertPubKey = ParseHex(""); + vAlertPubKey = ParseHex("04de6b00e3294afc25e03eead3fdb7b0dc9ebdf972625e40d79df84766c96a6ddfe8ae702c71f073ffa74fe69effd61ff7b27e8ceae2ac780cc786c278b270cffc"); + // Use this Private key for testnet 'sendalert' commands + // "308201130201010420792aeda8e312f4e1b26861e3d16a19cd01b45c5531c1d90a9d180335a28d3bc0a081a53081a2020101302c06072a8648ce3d0101022100fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f300604010004010704410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8022100fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141020101a14403420004de6b00e3294afc25e03eead3fdb7b0dc9ebdf972625e40d79df84766c96a6ddfe8ae702c71f073ffa74fe69effd61ff7b27e8ceae2ac780cc786c278b270cffc" + nDefaultPort = 53333; - nRPCPort = 53334; + nRPCPort = 53332; strDataDir = "testnet"; bnProofOfWorkLimit = CBigNum(~uint256(0) >> 30); nSubsidyHalvingInterval = 210000; diff --git a/src/clientversion.h b/src/clientversion.h index 7b4d44f..6f44bc1 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -3,23 +3,29 @@ #if defined(HAVE_CONFIG_H) #include "ixcoin-config.h" -#else + +// GR Note: Commenting this code out on 9/28/2014, if it was ever used it may NOT match what is used +// throughout the rest of the build process: +// See configure.ac, to set these values up, as the ixcoin-config.h +// file is built with these values defined as required by the developer +// +// #else // // client versioning and copyright year // // These need to be macros, as version.cpp's and ixcoin-qt.rc's voodoo requires it -#define CLIENT_VERSION_MAJOR 0 -#define CLIENT_VERSION_MINOR 9 -#define CLIENT_VERSION_REVISION 2 -#define CLIENT_VERSION_BUILD 1 +// #define CLIENT_VERSION_MAJOR 0 +// #define CLIENT_VERSION_MINOR 9 +// #define CLIENT_VERSION_REVISION 2 +// #define CLIENT_VERSION_BUILD 1 // Set to true for release, false for prerelease or test build -#define CLIENT_VERSION_IS_RELEASE true +// #define CLIENT_VERSION_IS_RELEASE true // Copyright year (2011-this) // Todo: update this when changing our copyright comments in the source -#define COPYRIGHT_YEAR 2014 +// #define COPYRIGHT_YEAR 2014 #endif //HAVE_CONFIG_H diff --git a/src/main.cpp b/src/main.cpp index ac4ac26..0f222a9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3466,9 +3466,20 @@ string GetWarnings(string strFor) if (GetBoolArg("-testsafemode", false)) strRPC = "test"; + // Ixcoin uses this feature for initial 'Pre-Release' builds, when your production code is finished, + // be sure to change this value to 'true', by setting it in the configure.ac file. Then reconfigure & build all + // from the source code. The sendalert' command functionally is ONLY included for pre-release builds, it is not + // included in final production builds. This is how Bitcoin is released, there is NO 'sendalert' command function + // available to clients. if (!CLIENT_VERSION_IS_RELEASE) strStatusBar = _("This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"); + // The piority of this message remains @ 0, yet if nothing else is found, it will be displayed by default for pre-release builds. + // Check for some high priority items to watch out for: + + // These nPriority values set an upper limit on what should be used by the development team, when issuing alert messages, + // as they are more important than anything else to this client's user.. + // Misc warnings like out of disk space and clock is wrong if (strMiscWarning != "") { @@ -3488,6 +3499,11 @@ string GetWarnings(string strFor) } // Alerts + // Any network wide alerts that have shown up, and have a greater priority + // than what is listed above, will now be checked and the highest + // priorty one is picked & shown to the user. + // NOTE: If two alerts have the same priority, it will be the 1st one + // found, that gets shown to the user. { LOCK(cs_mapAlerts); BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts) diff --git a/src/net.cpp b/src/net.cpp index 1ae376d..3ba6e69 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -350,7 +350,7 @@ bool GetMyExternalIP(CNetAddr& ipRet) const char* pszKeyword; for (int nLookup = 0; nLookup <= 1; nLookup++) - for (int nHost = 1; nHost <= 2; nHost++) + for (int nHost = 1; nHost <= 1; nHost++) { // We should be phasing out our use of sites like these. If we need // replacements, we should ask for volunteers to put this simple @@ -375,25 +375,6 @@ bool GetMyExternalIP(CNetAddr& ipRet) pszKeyword = "Address:"; } - else if (nHost == 2) - { - addrConnect = CService("74.208.43.192", 80); // www.showmyip.com - - if (nLookup == 1) - { - CService addrIP("www.showmyip.com", 80, true); - if (addrIP.IsValid()) - addrConnect = addrIP; - } - - pszGet = "GET /simple/ HTTP/1.1\r\n" - "Host: www.showmyip.com\r\n" - "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n" - "Connection: close\r\n" - "\r\n"; - - pszKeyword = NULL; // Returns just IP address - } if (GetMyExternalIP2(addrConnect, pszGet, pszKeyword, ipRet)) return true; diff --git a/src/qt/ixcoinstrings.cpp b/src/qt/ixcoinstrings.cpp index cfcb708..2e3fea2 100644 --- a/src/qt/ixcoinstrings.cpp +++ b/src/qt/ixcoinstrings.cpp @@ -75,7 +75,7 @@ QT_TRANSLATE_NOOP("ixcoin-core", "" "In this mode -genproclimit controls how many blocks are generated " "immediately."), QT_TRANSLATE_NOOP("ixcoin-core", "" -"Listen for JSON-RPC connections on (default: 8332 or testnet: 18332)"), +"Listen for JSON-RPC connections on (default: 8337 or testnet: 53333)"), QT_TRANSLATE_NOOP("ixcoin-core", "" "Number of seconds to keep misbehaving peers from reconnecting (default: " "86400)"), @@ -141,7 +141,7 @@ QT_TRANSLATE_NOOP("ixcoin-core", "Cannot write default address"), QT_TRANSLATE_NOOP("ixcoin-core", "Clear list of wallet transactions (diagnostic tool; implies -rescan)"), QT_TRANSLATE_NOOP("ixcoin-core", "Connect only to the specified node(s)"), QT_TRANSLATE_NOOP("ixcoin-core", "Connect through SOCKS proxy"), -QT_TRANSLATE_NOOP("ixcoin-core", "Connect to JSON-RPC on (default: 8332 or testnet: 18332)"), +QT_TRANSLATE_NOOP("ixcoin-core", "Connect to JSON-RPC on (default: 8337 or testnet: 53333)"), QT_TRANSLATE_NOOP("ixcoin-core", "Connect to a node to retrieve peer addresses, and disconnect"), QT_TRANSLATE_NOOP("ixcoin-core", "Connection options:"), QT_TRANSLATE_NOOP("ixcoin-core", "Corrupted block database detected"), diff --git a/src/rpcclient.cpp b/src/rpcclient.cpp index a9a84bc..5a51955 100644 --- a/src/rpcclient.cpp +++ b/src/rpcclient.cpp @@ -177,11 +177,17 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector 1) ConvertTo(params[1]); if (strMethod == "keypoolrefill" && n > 0) ConvertTo(params[0]); if (strMethod == "getrawmempool" && n > 0) ConvertTo(params[0]); - if (strMethod == "sendalert" && n > 2) ConvertTo(params[2]); - if (strMethod == "sendalert" && n > 3) ConvertTo(params[3]); - if (strMethod == "sendalert" && n > 4) ConvertTo(params[4]); - if (strMethod == "sendalert" && n > 5) ConvertTo(params[5]); - if (strMethod == "sendalert" && n > 6) ConvertTo(params[6]); + +// No need for these in release code +#if CLIENT_VERSION_IS_RELEASE != true + if (strMethod == "sendalert" && n > 2) ConvertTo(params[2]); + if (strMethod == "sendalert" && n > 3) ConvertTo(params[3]); + if (strMethod == "sendalert" && n > 4) ConvertTo(params[4]); + if (strMethod == "sendalert" && n > 5) ConvertTo(params[5]); + if (strMethod == "sendalert" && n > 6) ConvertTo(params[6]); + if (strMethod == "sendalert" && n > 7) ConvertTo(params[7]); + if (strMethod == "sendalert" && n > 8) ConvertTo(params[8]); +#endif return params; } @@ -268,7 +274,7 @@ std::string HelpMessageCli(bool mainProgram) } strUsage += " -rpcconnect= " + _("Send commands to node running on (default: 127.0.0.1)") + "\n"; - strUsage += " -rpcport= " + _("Connect to JSON-RPC on (default: 8332 or testnet: 18332)") + "\n"; + strUsage += " -rpcport= " + _("Connect to JSON-RPC on (default: 8337 or testnet: 53333)") + "\n"; strUsage += " -rpcwait " + _("Wait for RPC server to start") + "\n"; if(mainProgram) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 79acfcd..c7d6095 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -10,7 +10,6 @@ #include "netbase.h" #include "rpcserver.h" #include "util.h" -#include "alert.h" #ifdef ENABLE_WALLET #include "wallet.h" #include "walletdb.h" @@ -326,65 +325,3 @@ Value verifymessage(const Array& params, bool fHelp) return (pubkey.GetID() == keyID); } - -Value sendalert(const Array& params, bool fHelp) -{ - if (fHelp || params.size() < 6) - throw runtime_error( - "sendalert [cancelupto]\n" - " is the alert text message\n" - " is hex string of alert master private key\n" - " is the minimum applicable internal client version\n" - " is the maximum applicable internal client version\n" - " is integer priority number\n" - " is the alert id\n" - "[cancelupto] cancels all alert id's up to this number\n" - "Returns JSON result if sucsessful."); - - CAlert alert; - CKey key; - - alert.strStatusBar = params[0].get_str(); - alert.nMinVer = params[2].get_int(); - alert.nMaxVer = params[3].get_int(); - alert.nPriority = params[4].get_int(); - alert.nID = params[5].get_int(); - if (params.size() > 6) - alert.nCancel = params[6].get_int(); - alert.nVersion = PROTOCOL_VERSION; - alert.nRelayUntil = GetAdjustedTime() + 365*24*60*60; - alert.nExpiration = GetAdjustedTime() + 365*24*60*60; - - CDataStream sMsg(SER_NETWORK, PROTOCOL_VERSION); - sMsg << (CUnsignedAlert)alert; - alert.vchMsg = vector(sMsg.begin(), sMsg.end()); - - vector vchPrivKey = ParseHex(params[1].get_str()); - - // if key is not correct openssl may crash, comment taken from other coin source. not sure it's valid now in v0.9.2.1? - // Added runtime_error on SetPrivKey returning false... - if( !key.SetPrivKey( CPrivKey(vchPrivKey.begin(), vchPrivKey.end()), FALSE ) ) - throw runtime_error( "Unable to verify alert Private key, check private key?\n"); - else if (!key.Sign(Hash(alert.vchMsg.begin(), alert.vchMsg.end()), alert.vchSig)) - throw runtime_error( "Unable to sign alert, check private key?\n"); - else if(!alert.ProcessAlert()) - throw runtime_error( "Failed to process alert.\n"); - - // Relay alert - { - LOCK(cs_vNodes); - BOOST_FOREACH(CNode* pnode, vNodes) - alert.RelayTo(pnode); - } - - Object result; - result.push_back(Pair("strStatusBar", alert.strStatusBar)); - result.push_back(Pair("nVersion", alert.nVersion)); - result.push_back(Pair("nMinVer", alert.nMinVer)); - result.push_back(Pair("nMaxVer", alert.nMaxVer)); - result.push_back(Pair("nPriority", alert.nPriority)); - result.push_back(Pair("nID", alert.nID)); - if (alert.nCancel > 0) - result.push_back(Pair("nCancel", alert.nCancel)); - return result; -} diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index aec59b9..b6edf48 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -10,6 +10,7 @@ #include "protocol.h" #include "sync.h" #include "util.h" +#include "alert.h" #include #include "json/json_spirit_value.h" @@ -89,7 +90,7 @@ Value getpeerinfo(const Array& params, bool fHelp) " \"pingtime\": n, (numeric) ping time\n" " \"pingwait\": n, (numeric) ping wait\n" " \"version\": v, (numeric) The peer version, such as 7001\n" - " \"subver\": \"/Satoshi:0.8.5/\", (string) The string version\n" + " \"subver\": \"/Satoshi:0.9.2/\", (string) The string version\n" " \"inbound\": true|false, (boolean) Inbound (true) or Outbound (false)\n" " \"startingheight\": n, (numeric) The starting height (block) of the peer\n" " \"banscore\": n, (numeric) The ban score (stats.nMisbehavior)\n" @@ -352,6 +353,14 @@ Value getnetworkinfo(const Array& params, bool fHelp) " \"address\": \"xxxx\", (string) network address\n" " \"port\": xxx, (numeric) network port\n" " \"score\": xxx (numeric) relative score\n" + " \"alerts\": [, (array) list of alerts on network\n" + " \"alertid\": \"xxx\", (numeric) the ID number for this alert\n" + " \"priority\": xxx, (numeric) the alert priority\n" + " \"minver\": xxx (numeric) the minimum protocal version this effects\n" + " \"maxver\": xxx (numeric) the maximum protocal version this effects\n" + " \"relayuntil\": xxx (numeric) relay this alert to other nodes until this time\n" + " \"expiration\": xxx (numeric) when this alert will expire\n" + " \"statusbar\": \"xxxx\", (string) status bar & tooltip string displayed\n" " ]\n" "}\n" "\nExamples:\n" @@ -382,5 +391,141 @@ Value getnetworkinfo(const Array& params, bool fHelp) } } obj.push_back(Pair("localaddresses", localAddresses)); + + // Add in the list of alerts currently on the network + Array localAlerts; + if( !mapAlerts.empty() ) { + // Parse all the alerts, and prepare a JSON response list + LOCK(cs_mapAlerts); + for( map::iterator mi = mapAlerts.begin(); mi != mapAlerts.end(); mi++ ) { + const CAlert& alert = (*mi).second; + Object rec; + rec.push_back( Pair("AlertID", alert.nID) ); + rec.push_back( Pair("Priority", alert.nPriority) ); + rec.push_back( Pair("MinVer", alert.nMinVer) ); + rec.push_back( Pair("MaxVer", alert.nMaxVer) ); + rec.push_back( Pair("RelayUntil", alert.nRelayUntil) ); + rec.push_back( Pair("Expiration", alert.nExpiration) ); + rec.push_back( Pair("StatusBar", alert.strStatusBar) ); + localAlerts.push_back(rec); + } + } + obj.push_back(Pair("alerts", localAlerts)); + return obj; } + +// Only build this code in preleases or test builds +#if CLIENT_VERSION_IS_RELEASE != true +// +// This allows our developers and foundation to notify all nodes of any issues on the Ixcoin network +// +Value sendalert(const Array& params, bool fHelp) +{ + if (fHelp || params.size() < 6) + throw runtime_error( + "sendalert [cancelupto] [relaydays] [expiredays]\n" + " is the alert text message\n" + " is hex string of alert master private key\n" + " is the minimum applicable internal client version\n" + " is the maximum applicable internal client version\n" + " is integer priority number\n" + " is the alert id\n" + "[cancelupto] cancels all alert id's up to this number\n" + "[relaydays] relay this alert for this many days\n" + "[expiredays] expire this alert in this many days\n" + "Returns JSON result if sucsessful."); + + CAlert alert; + CKey key; + + alert.strStatusBar = params[0].get_str(); + alert.nMinVer = params[2].get_int(); + alert.nMaxVer = params[3].get_int(); + alert.nPriority = params[4].get_int(); + alert.nID = params[5].get_int(); + if (params.size() > 6) + alert.nCancel = params[6].get_int(); + alert.nVersion = PROTOCOL_VERSION; + + // Relay and don't expire this alert for one year, or the number of days given + const int64_t i64Days = 24*60*60; // One day + const int64_t i64AlertNow = GetAdjustedTime(); + alert.nRelayUntil = ( params.size() > 7 ) ? params[7].get_int() : 365; + alert.nRelayUntil *= i64Days; + alert.nRelayUntil += i64AlertNow; + + alert.nExpiration = ( params.size() > 8 ) ? params[8].get_int() : 365; + alert.nExpiration *= i64Days; + alert.nExpiration += i64AlertNow; + + CDataStream sMsg(SER_NETWORK, PROTOCOL_VERSION); + sMsg << (CUnsignedAlert)alert; + alert.vchMsg = vector(sMsg.begin(), sMsg.end()); + + // From https://bitcointalk.org/index.php?topic=50330.40: + // + // CKey::GetPrivKey and CKey::SetPrivKey are accessor methods for the 279-byte DES private key. + // CKey::GetSecret and CKey::SetSecret are accessor methods for the 32-byte private key. + // + // Those of you who are interested in the OpenSSL calls needed, it's all spelled out in key.h + // + // If the SendAlert user is giving us the 32 byte secret code & we already know the public key, so... + // Setup an object with the correct value for the private key, otherwise we'll assume they are giving us the + // private key as the string value, and use that to create the key object. + // Either of the above most be given, before this code can sign and then process the alert. + // + // There are various code fragments below that are commented out for release builds. Helpful however, for debugging + // changes to the code and/or keys being used. Otherwise not needed + // + // Move the SendAlert 2nd parmeter chars into a vector, whickever it is, can assume it's being given to us as hex pairs + vector vchPrivKey = ParseHex(params[1].get_str()); + + if( vchPrivKey.size() == 32 ) { // Then we're given only a 32-byte private key multipler + key.Set( vchPrivKey.begin(), vchPrivKey.end(), FALSE ); + CPrivKey nPK = key.GetPrivKey(); // This calls openssl & sets the key structure up correctly. + // Print out the private key here, from being set by SecretBytes... + // std::string strKey; + // for( size_t i=0; i 0) + res.push_back( Pair("Cancel", alert.nCancel) ); + return res; +} +#endif \ No newline at end of file diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 098bdc0..2411d1b 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -159,22 +159,27 @@ string CRPCTable::help(string strCommand) const continue; #endif - try - { +#if CLIENT_VERSION_IS_RELEASE != true + if( strMethod != "sendalert" ) // Don't show this command to everyone using the client +#endif + { + try + { Array params; rpcfn_type pfn = pcmd->actor; if (setDone.insert(pfn).second) (*pfn)(params, true); - } - catch (std::exception& e) - { + } + catch (std::exception& e) + { // Help text is returned in an exception string strHelp = string(e.what()); if (strCommand == "") if (strHelp.find('\n') != string::npos) strHelp = strHelp.substr(0, strHelp.find('\n')); strRet += strHelp + "\n"; - } + } + } } if (strRet == "") strRet = strprintf("help: unknown command: %s\n", strCommand); @@ -270,7 +275,10 @@ static const CRPCCommand vRPCCommands[] = { "createmultisig", &createmultisig, true, true , false }, { "validateaddress", &validateaddress, true, false, false }, /* uses wallet if enabled */ { "verifymessage", &verifymessage, false, false, false }, +// Only build this code in preleases or test builds +#if CLIENT_VERSION_IS_RELEASE != true { "sendalert", &sendalert, false, false, false }, /* So client can sendalerts if the private key is known */ +#endif #ifdef ENABLE_WALLET /* Wallet */ diff --git a/src/util.cpp b/src/util.cpp index 9e0c767..0cbad06 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1327,7 +1327,7 @@ string FormatFullVersion() return CLIENT_BUILD; } -// Format the subversion field according to BIP 14 spec (https://en.ixcoin.it/wiki/BIP_0014) +// Format the subversion field according to BIP 14 spec (https://en.bitcoin.it/wiki/BIP_0014) std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector& comments) { std::ostringstream ss;