Browse Source

more replacement to Gostcoin

pull/7/head
orignal 7 years ago
parent
commit
8660b945ed
  1. 16
      src/bitcoinrpc.cpp
  2. 14
      src/init.cpp
  3. 14
      src/main.cpp
  4. 6
      src/net.cpp
  5. 8
      src/rpcdump.cpp
  6. 4
      src/rpcrawtransaction.cpp
  7. 6
      src/util.h

16
src/bitcoinrpc.cpp

@ -182,10 +182,10 @@ Value stop(const Array& params, bool fHelp) @@ -182,10 +182,10 @@ Value stop(const Array& params, bool fHelp)
if (fHelp || params.size() > 1)
throw runtime_error(
"stop\n"
"Stop Anoncoin server.");
"Stop Gostcoin server.");
// Shutdown will take long enough that the response should get back
StartShutdown();
return "Anoncoin server stopping";
return "Gostcoin server stopping";
}
@ -298,7 +298,7 @@ string HTTPPost(const string& strMsg, const map<string,string>& mapRequestHeader @@ -298,7 +298,7 @@ string HTTPPost(const string& strMsg, const map<string,string>& mapRequestHeader
{
ostringstream s;
s << "POST / HTTP/1.1\r\n"
<< "User-Agent: anoncoin-json-rpc/" << FormatFullVersion() << "\r\n"
<< "User-Agent: gostcoin-json-rpc/" << FormatFullVersion() << "\r\n"
<< "Host: 127.0.0.1\r\n"
<< "Content-Type: application/json\r\n"
<< "Content-Length: " << strMsg.size() << "\r\n"
@ -329,7 +329,7 @@ static string HTTPReply(int nStatus, const string& strMsg, bool keepalive) @@ -329,7 +329,7 @@ static string HTTPReply(int nStatus, const string& strMsg, bool keepalive)
if (nStatus == HTTP_UNAUTHORIZED)
return strprintf("HTTP/1.0 401 Authorization Required\r\n"
"Date: %s\r\n"
"Server: anoncoin-json-rpc/%s\r\n"
"Server: gostcoin-json-rpc/%s\r\n"
"WWW-Authenticate: Basic realm=\"jsonrpc\"\r\n"
"Content-Type: text/html\r\n"
"Content-Length: 296\r\n"
@ -356,7 +356,7 @@ static string HTTPReply(int nStatus, const string& strMsg, bool keepalive) @@ -356,7 +356,7 @@ static string HTTPReply(int nStatus, const string& strMsg, bool keepalive)
"Connection: %s\r\n"
"Content-Length: %" PRIszu "\r\n"
"Content-Type: application/json\r\n"
"Server: anoncoin-json-rpc/%s\r\n"
"Server: gostcoin-json-rpc/%s\r\n"
"\r\n"
"%s",
nStatus,
@ -736,7 +736,7 @@ void StartRPCThreads() @@ -736,7 +736,7 @@ void StartRPCThreads()
{
unsigned char rand_pwd[32];
RAND_bytes(rand_pwd, 32);
string strWhatAmI = "To use anoncoind";
string strWhatAmI = "To use gostcoind";
if (mapArgs.count("-server"))
strWhatAmI = strprintf(_("To use the %s option"), "\"-server\"");
else if (mapArgs.count("-daemon"))
@ -745,13 +745,13 @@ void StartRPCThreads() @@ -745,13 +745,13 @@ void StartRPCThreads()
_("%s, you must set a rpcpassword in the configuration file:\n"
"%s\n"
"It is recommended you use the following random password:\n"
"rpcuser=anoncoinrpc\n"
"rpcuser=gostcoinrpc\n"
"rpcpassword=%s\n"
"(you do not need to remember this password)\n"
"The username and password MUST NOT be the same.\n"
"If the file does not exist, create it with owner-readable-only file permissions.\n"
"It is also recommended to set alertnotify so you are notified of problems;\n"
"for example: alertnotify=echo %%s | mail -s \"Anoncoin Alert\" admin@foo.com\n"),
"for example: alertnotify=echo %%s | mail -s \"Gostcoin Alert\" admin@foo.com\n"),
strWhatAmI.c_str(),
GetConfigFile().string().c_str(),
EncodeBase58(&rand_pwd[0],&rand_pwd[0]+32).c_str()),

14
src/init.cpp

@ -214,7 +214,7 @@ bool AppInit(int argc, char* argv[]) @@ -214,7 +214,7 @@ bool AppInit(int argc, char* argv[])
// Command-line RPC
for (int i = 1; i < argc; i++)
if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "anoncoin:"))
if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "gostcoin:"))
fCommandLine = true;
if (fCommandLine)
@ -323,8 +323,8 @@ std::string HelpMessage() @@ -323,8 +323,8 @@ std::string HelpMessage()
{
string strUsage = _("Options:") + "\n" +
" -? " + _("This help message") + "\n" +
" -conf=<file> " + _("Specify configuration file (default: anoncoin.conf)") + "\n" +
" -pid=<file> " + _("Specify pid file (default: anoncoind.pid)") + "\n" +
" -conf=<file> " + _("Specify configuration file (default: gostcoin.conf)") + "\n" +
" -pid=<file> " + _("Specify pid file (default: gostcoind.pid)") + "\n" +
" -gen " + _("Generate coins (default: 0)") + "\n" +
" -datadir=<dir> " + _("Specify data directory") + "\n" +
" -dbcache=<n> " + _("Set database cache size in megabytes (default: 25)") + "\n" +
@ -400,7 +400,7 @@ std::string HelpMessage() @@ -400,7 +400,7 @@ std::string HelpMessage()
" -blockmaxsize=<n> " + _("Set maximum block size in bytes (default: 250000)") + "\n" +
" -blockprioritysize=<n> " + _("Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)") + "\n" +
"\n" + _("SSL options: (see the Anoncoin Wiki for SSL setup instructions)") + "\n" +
"\n" + _("SSL options: (see the Gostcoin Wiki for SSL setup instructions)") + "\n" +
" -rpcssl " + _("Use OpenSSL (https) for JSON-RPC connections") + "\n" +
" -rpcsslcertificatechainfile=<file.cert> " + _("Server certificate file (default: server.cert)") + "\n" +
" -rpcsslprivatekeyfile=<file.pem> " + _("Server private key (default: server.pem)") + "\n" +
@ -410,7 +410,7 @@ std::string HelpMessage() @@ -410,7 +410,7 @@ std::string HelpMessage()
" -generatei2pdestination " + _("Generate an I2P destination, print it and exit.")+ "\n" +
" -i2p=1 " + _("Enable I2P.") + "\n" +
" -onlynet=i2p " + _("Enable I2P only mode.") + "\n" +
" -i2psessionname=<session name> " + _("Name of an I2P session. If it is not specified, value will be \"Anoncoin-client\"") + "\n" +
" -i2psessionname=<session name> " + _("Name of an I2P session. If it is not specified, value will be \"Gostcoin-client\"") + "\n" +
" -samhost=<ip or host name> " + _("Address of the SAM bridge host. If it is not specified, value will be \"127.0.0.1\".") + "\n" +
" -samport=<port> " + _("Port number of the SAM bridge host. If it is not specified, value will be \"7656\".") + "\n" +
" -mydestination=<pub+priv i2p-keys> " + _("Your full destination (public+private keys). If it is not specified, the client will geneterate a random destination for you. See below (Starting wallet with a permanent i2p-address) more details about this option.") +
@ -1089,10 +1089,10 @@ bool AppInit2(boost::thread_group& threadGroup) @@ -1089,10 +1089,10 @@ bool AppInit2(boost::thread_group& threadGroup)
InitWarning(msg);
}
else if (nLoadWalletRet == DB_TOO_NEW)
strErrors << _("Error loading wallet.dat: Wallet requires newer version of Anoncoin") << "\n";
strErrors << _("Error loading wallet.dat: Wallet requires newer version of Gostcoin") << "\n";
else if (nLoadWalletRet == DB_NEED_REWRITE)
{
strErrors << _("Wallet needed to be rewritten: restart Anoncoin to complete") << "\n";
strErrors << _("Wallet needed to be rewritten: restart Gostcoin to complete") << "\n";
printf("%s", strErrors.str().c_str());
return InitError(strErrors.str());
}

14
src/main.cpp

@ -1070,7 +1070,7 @@ uint256 static GetOrphanRoot(const CBlockHeader* pblock) @@ -1070,7 +1070,7 @@ uint256 static GetOrphanRoot(const CBlockHeader* pblock)
int64 static GetBlockValue(int nHeight, int64 nFees)
{
int64 nSubsidy = 5 * COIN;
// Some adjustments to the start of the lifetime to Anoncoin
// Some adjustments to the start of the lifetime to Gostcoin
if (nHeight < 42000) {
nSubsidy = 4.2 * COIN;
} else if (nHeight < 77777) { // All luck is seven ;)
@ -1078,15 +1078,15 @@ int64 static GetBlockValue(int nHeight, int64 nFees) @@ -1078,15 +1078,15 @@ int64 static GetBlockValue(int nHeight, int64 nFees)
} else if (nHeight == 77778) {
nSubsidy = 10 * COIN;
} else {
nSubsidy >>= (nHeight / 306600); // Anoncoin: 306600 blocks in ~2 years
nSubsidy >>= (nHeight / 306600); // Gostcoin: 306600 blocks in ~2 years
}
return nSubsidy + nFees;
}
// Protocol 1 & 2
static const int64 nTargetTimespan = 86184; //420 * 205.2; = 86184 // Anoncoin: 420 blocks
static const int64 nTargetSpacing = 205;//3.42 * 60; // Anoncoin: 3.42 minutes
static const int64 nTargetTimespan = 86184; //420 * 205.2; = 86184 // Gostcoin: 420 blocks
static const int64 nTargetSpacing = 205;//3.42 * 60; // Gostcoin: 3.42 minutes
static const int64 nInterval = nTargetTimespan / nTargetSpacing;
static const int nDifficultySwitchHeight = 15420;
@ -1098,7 +1098,7 @@ static const int nDifficultyProtocol3 = 87777; @@ -1098,7 +1098,7 @@ static const int nDifficultyProtocol3 = 87777;
unsigned int static KimotoGravityWell(const CBlockIndex* pindexLast, const CBlockHeader *pblock, uint64 TargetBlocksSpacingSeconds, uint64 PastBlocksMin, uint64 PastBlocksMax) {
/* current difficulty formula, Anoncoin - kimoto gravity well */
/* current difficulty formula, Gostcoin - kimoto gravity well */
const CBlockIndex *BlockLastSolved = pindexLast;
const CBlockIndex *BlockReading = pindexLast;
const CBlockHeader *BlockCreating = pblock;
@ -1201,7 +1201,7 @@ unsigned int static OldGetNextWorkRequired(const CBlockIndex* pindexLast, const @@ -1201,7 +1201,7 @@ unsigned int static OldGetNextWorkRequired(const CBlockIndex* pindexLast, const
if (pindexLast == NULL)
return nProofOfWorkLimit;
// Anoncoin difficulty adjustment protocol switch (Thanks to FeatherCoin for this idea)
// Gostcoin difficulty adjustment protocol switch (Thanks to FeatherCoin for this idea)
static const int newTargetTimespan = 2050;
int nHeight = pindexLast->nHeight + 1;
@ -1229,7 +1229,7 @@ unsigned int static OldGetNextWorkRequired(const CBlockIndex* pindexLast, const @@ -1229,7 +1229,7 @@ unsigned int static OldGetNextWorkRequired(const CBlockIndex* pindexLast, const
return pindexLast->nBits;
}
// Anoncoin: This fixes an issue where a 51% attack can change difficulty at will.
// Gostcoin: This fixes an issue where a 51% attack can change difficulty at will.
// Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
int blockstogoback = nInterval-1;
if ((pindexLast->nHeight+1) != nInterval)

6
src/net.cpp

@ -433,7 +433,7 @@ bool GetMyExternalIP(CNetAddr& ipRet) @@ -433,7 +433,7 @@ bool GetMyExternalIP(CNetAddr& ipRet)
void ThreadGetMyExternalIP(void* parg)
{
// Make this thread recognisable as the external IP detection thread
RenameThread("anoncoin-ext-ip");
RenameThread("gostcoin-ext-ip");
if (IsI2POnly())
return;
@ -1276,7 +1276,7 @@ void ThreadMapPort() @@ -1276,7 +1276,7 @@ void ThreadMapPort()
}
}
string strDesc = "Anoncoin " + FormatFullVersion();
string strDesc = "Gostcoin " + FormatFullVersion();
try {
loop {
@ -1882,7 +1882,7 @@ bool BindListenPort(const CService &addrBind, string& strError) @@ -1882,7 +1882,7 @@ bool BindListenPort(const CService &addrBind, string& strError)
{
int nErr = WSAGetLastError();
if (nErr == WSAEADDRINUSE)
strError = strprintf(_("Unable to bind to %s on this computer. Anoncoin is probably already running."), addrBind.ToString().c_str());
strError = strprintf(_("Unable to bind to %s on this computer. Gostcoin is probably already running."), addrBind.ToString().c_str());
else
strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %d, %s)"), addrBind.ToString().c_str(), nErr, strerror(nErr));
printf("%s\n", strError.c_str());

8
src/rpcdump.cpp

@ -36,7 +36,7 @@ Value importprivkey(const Array& params, bool fHelp) @@ -36,7 +36,7 @@ Value importprivkey(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 3)
throw runtime_error(
"importprivkey <anoncoinprivkey> [label] [rescan=true]\n"
"importprivkey <gostcoinprivkey> [label] [rescan=true]\n"
"Adds a private key (as returned by dumpprivkey) to your wallet.");
string strSecret = params[0].get_str();
@ -79,13 +79,13 @@ Value dumpprivkey(const Array& params, bool fHelp) @@ -79,13 +79,13 @@ Value dumpprivkey(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
"dumpprivkey <anoncoinaddress>\n"
"Reveals the private key corresponding to <anoncoinaddress>.");
"dumpprivkey <gostcoinaddress>\n"
"Reveals the private key corresponding to <gostcoinaddress>.");
string strAddress = params[0].get_str();
CBitcoinAddress address;
if (!address.SetString(strAddress))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Anoncoin address");
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Gostcoin address");
CKeyID keyID;
if (!address.GetKeyID(keyID))
throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to a key");

4
src/rpcrawtransaction.cpp

@ -195,7 +195,7 @@ Value listunspent(const Array& params, bool fHelp) @@ -195,7 +195,7 @@ Value listunspent(const Array& params, bool fHelp)
{
CBitcoinAddress address(input.get_str());
if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Anoncoin address: ")+input.get_str());
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Gostcoin address: ")+input.get_str());
if (setAddress.count(address))
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+input.get_str());
setAddress.insert(address);
@ -294,7 +294,7 @@ Value createrawtransaction(const Array& params, bool fHelp) @@ -294,7 +294,7 @@ Value createrawtransaction(const Array& params, bool fHelp)
{
CBitcoinAddress address(s.name_);
if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Anoncoin address: ")+s.name_);
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Gostcoin address: ")+s.name_);
if (setAddress.count(address))
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+s.name_);

6
src/util.h

@ -27,7 +27,7 @@ @@ -27,7 +27,7 @@
#include <boost/date_time/gregorian/gregorian_types.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
// Anoncoin
// Gostcoin
// For writing config file
#include <boost/property_tree/ptree.hpp>
@ -131,7 +131,7 @@ inline void MilliSleep(int64 n) @@ -131,7 +131,7 @@ inline void MilliSleep(int64 n)
#endif
// Anoncoin
// Gostcoin
bool WriteConfig(boost::filesystem::path configFile, boost::property_tree::ptree data);
bool writeFirstConfig(bool i2pOnlyEnabled, bool torOnlyEnabled, bool i2pEnabled, bool torEnabled);
@ -576,7 +576,7 @@ inline uint32_t ByteReverse(uint32_t value) @@ -576,7 +576,7 @@ inline uint32_t ByteReverse(uint32_t value)
// threadGroup.create_thread(boost::bind(&LoopForever<boost::function<void()> >, "nothing", f, milliseconds));
template <typename Callable> void LoopForever(const char* name, Callable func, int64 msecs)
{
std::string s = strprintf("anoncoin-%s", name);
std::string s = strprintf("gostcoin-%s", name);
RenameThread(s.c_str());
printf("%s thread start\n", name);
try

Loading…
Cancel
Save