raw
genesis                 1 // Copyright (c) 2009-2010 Satoshi Nakamoto
genesis 2 // Copyright (c) 2009-2012 The Bitcoin developers
genesis 3 // Distributed under the MIT/X11 software license, see the accompanying
genesis 4 // file license.txt or http://www.opensource.org/licenses/mit-license.php.
genesis 5 #include "headers.h"
genesis 6 #include "db.h"
genesis 7 #include "bitcoinrpc.h"
genesis 8 #include "net.h"
genesis 9 #include "init.h"
genesis 10 #include "strlcpy.h"
genesis 11 #include <boost/filesystem.hpp>
genesis 12 #include <boost/filesystem/fstream.hpp>
genesis 13 #include <boost/interprocess/sync/file_lock.hpp>
genesis 14
makefiles 15 // v0.5.4 RELEASE
genesis 16
genesis 17 using namespace std;
genesis 18 using namespace boost;
genesis 19
genesis 20 CWallet* pwalletMain;
genesis 21
genesis 22 //////////////////////////////////////////////////////////////////////////////
genesis 23 //
genesis 24 // Shutdown
genesis 25 //
genesis 26
genesis 27 void ExitTimeout(void* parg)
genesis 28 {
genesis 29 }
genesis 30
genesis 31 void Shutdown(void* parg)
genesis 32 {
genesis 33 static CCriticalSection cs_Shutdown;
genesis 34 static bool fTaken;
genesis 35 bool fFirstThread = false;
genesis 36 TRY_CRITICAL_BLOCK(cs_Shutdown)
genesis 37 {
genesis 38 fFirstThread = !fTaken;
genesis 39 fTaken = true;
genesis 40 }
genesis 41 static bool fExit;
genesis 42 if (fFirstThread)
genesis 43 {
genesis 44 fShutdown = true;
genesis 45 nTransactionsUpdated++;
genesis 46 DBFlush(false);
genesis 47 StopNode();
genesis 48 DBFlush(true);
genesis 49 boost::filesystem::remove(GetPidFile());
genesis 50 UnregisterWallet(pwalletMain);
genesis 51 delete pwalletMain;
genesis 52 CreateThread(ExitTimeout, NULL);
genesis 53 Sleep(50);
genesis 54 printf("Bitcoin exiting\n\n");
genesis 55 fExit = true;
genesis 56 exit(0);
genesis 57 }
genesis 58 else
genesis 59 {
genesis 60 while (!fExit)
genesis 61 Sleep(500);
genesis 62 Sleep(100);
genesis 63 ExitThread(0);
genesis 64 }
genesis 65 }
genesis 66
genesis 67 void HandleSIGTERM(int)
genesis 68 {
genesis 69 fRequestShutdown = true;
genesis 70 }
genesis 71
genesis 72
genesis 73
genesis 74
genesis 75
genesis 76
genesis 77 //////////////////////////////////////////////////////////////////////////////
genesis 78 //
genesis 79 // Start
genesis 80 //
bitcoin-asciilife... 81
genesis 82 int main(int argc, char* argv[])
genesis 83 {
genesis 84 bool fRet = false;
genesis 85 fRet = AppInit(argc, argv);
genesis 86
genesis 87 if (fRet && fDaemon)
genesis 88 return 0;
genesis 89
genesis 90 return 1;
genesis 91 }
bitcoin-asciilife... 92
genesis 93
genesis 94 bool AppInit(int argc, char* argv[])
genesis 95 {
genesis 96 bool fRet = false;
genesis 97 try
genesis 98 {
genesis 99 fRet = AppInit2(argc, argv);
genesis 100 }
genesis 101 catch (std::exception& e) {
genesis 102 PrintException(&e, "AppInit()");
genesis 103 } catch (...) {
genesis 104 PrintException(NULL, "AppInit()");
genesis 105 }
genesis 106 if (!fRet)
genesis 107 Shutdown(NULL);
genesis 108 return fRet;
genesis 109 }
genesis 110
genesis 111 bool AppInit2(int argc, char* argv[])
genesis 112 {
genesis 113 umask(077);
bitcoin-asciilife... 114
genesis 115 // Clean shutdown on SIGTERM
genesis 116 struct sigaction sa;
genesis 117 sa.sa_handler = HandleSIGTERM;
genesis 118 sigemptyset(&sa.sa_mask);
genesis 119 sa.sa_flags = 0;
genesis 120 sigaction(SIGTERM, &sa, NULL);
genesis 121 sigaction(SIGINT, &sa, NULL);
genesis 122 sigaction(SIGHUP, &sa, NULL);
genesis 123
genesis 124 //
genesis 125 // Parameters
genesis 126 //
genesis 127 ParseParameters(argc, argv);
genesis 128
genesis 129 if (mapArgs.count("-datadir"))
genesis 130 {
genesis 131 if (filesystem::is_directory(filesystem::system_complete(mapArgs["-datadir"])))
genesis 132 {
genesis 133 filesystem::path pathDataDir = filesystem::system_complete(mapArgs["-datadir"]);
genesis 134 strlcpy(pszSetDataDir, pathDataDir.string().c_str(), sizeof(pszSetDataDir));
genesis 135 }
genesis 136 else
genesis 137 {
genesis 138 fprintf(stderr, "Error: Specified directory does not exist\n");
genesis 139 Shutdown(NULL);
genesis 140 }
genesis 141 }
genesis 142
genesis 143
genesis 144 ReadConfigFile(mapArgs, mapMultiArgs); // Must be done after processing datadir
genesis 145
genesis 146 if (mapArgs.count("-?") || mapArgs.count("--help"))
genesis 147 {
genesis 148 string strUsage = string() +
genesis 149 _("Bitcoin version") + " " + FormatFullVersion() + "\n\n" +
genesis 150 _("Usage:") + "\t\t\t\t\t\t\t\t\t\t\n" +
genesis 151 " bitcoind [options] \t " + "\n" +
genesis 152 " bitcoind [options] <command> [params]\t " + _("Send command to -server or bitcoind\n") +
genesis 153 " bitcoind [options] help \t\t " + _("List commands\n") +
genesis 154 " bitcoind [options] help <command> \t\t " + _("Get help for a command\n") +
genesis 155 _("Options:\n") +
genesis 156 " -conf=<file> \t\t " + _("Specify configuration file (default: bitcoin.conf)\n") +
genesis 157 " -pid=<file> \t\t " + _("Specify pid file (default: bitcoind.pid)\n") +
genesis 158 " -gen \t\t " + _("Generate coins\n") +
genesis 159 " -gen=0 \t\t " + _("Don't generate coins\n") +
genesis 160 " -min \t\t " + _("Start minimized\n") +
genesis 161 " -datadir=<dir> \t\t " + _("Specify data directory\n") +
genesis 162 " -timeout=<n> \t " + _("Specify connection timeout (in milliseconds)\n") +
genesis 163 " -proxy=<ip:port> \t " + _("Connect through socks4 proxy\n") +
asciilifeform_let... 164 " -port=<port> \t\t " + _("Listen for connections on <port> (default: 8333)\n") +
genesis 165 " -maxconnections=<n>\t " + _("Maintain at most <n> connections to peers (default: 125)\n") +
asciilifeform_ver... 166 " -myip=<ip> \t " + _("Set this node's external IP address.\n") +
asciilifeform_wir... 167 " -addwire=<ip> \t " + _("Add a hardwired node to connect to\n") +
asciilifeform_wir... 168 " -wirerefresh=<ip>\t " + _("Interval for refreshing wires.\n") +
genesis 169 " -addnode=<ip> \t " + _("Add a node to connect to\n") +
genesis 170 " -connect=<ip> \t\t " + _("Connect only to the specified node\n") +
genesis 171 " -nolisten \t " + _("Don't accept connections from outside\n") +
genesis 172 " -banscore=<n> \t " + _("Threshold for disconnecting misbehaving peers (default: 100)\n") +
genesis 173 " -bantime=<n> \t " + _("Number of seconds to keep misbehaving peers from reconnecting (default: 86400)\n") +
genesis 174 " -maxreceivebuffer=<n>\t " + _("Maximum per-connection receive buffer, <n>*1000 bytes (default: 10000)\n") +
genesis 175 " -maxsendbuffer=<n>\t " + _("Maximum per-connection send buffer, <n>*1000 bytes (default: 10000)\n") +
genesis 176 " -paytxfee=<amt> \t " + _("Fee per kB to add to transactions you send\n") +
genesis 177 " -daemon \t\t " + _("Run in the background as a daemon and accept commands\n") +
genesis 178 " -debug \t\t " + _("Output extra debugging information\n") +
asciilifeform_and... 179 " -caneat \t\t " + _("Permit the use of 'eatblock'\n") +
asciilifeform_add... 180 " -verifyall \t\t " + _("Forbid the skipping of ECDSA signature verification between checkpoints.\n") +
programmable-vers... 181 " -setverstring \t\t " + _("Set a custom version string.\n") +
programmable-vers... 182 " -setvernum \t\t " + _("Set a custom version number.\n") +
mod6_der_high_low_s 183 " -highs \t\t " + _("Set all transactions to have DER 'S' Value set to 'high'.\n") +
mod6_der_high_low_s 184 " -lows \t\t " + _("Set all transactions to have DER 'S' Value set to 'low'.\n") +
genesis 185 " -logtimestamps \t " + _("Prepend debug output with timestamp\n") +
genesis 186 " -printtoconsole \t " + _("Send trace/debug info to console instead of debug.log file\n") +
genesis 187 " -rpcuser=<user> \t " + _("Username for JSON-RPC connections\n") +
genesis 188 " -rpcpassword=<pw>\t " + _("Password for JSON-RPC connections\n") +
genesis 189 " -rpcport=<port> \t\t " + _("Listen for JSON-RPC connections on <port> (default: 8332)\n") +
genesis 190 " -rpcallowip=<ip> \t\t " + _("Allow JSON-RPC connections from specified IP address\n") +
genesis 191 " -rpcconnect=<ip> \t " + _("Send commands to node running on <ip> (default: 127.0.0.1)\n") +
genesis 192 " -keypool=<n> \t " + _("Set key pool size to <n> (default: 100)\n") +
genesis 193 " -rescan \t " + _("Rescan the block chain for missing wallet transactions\n");
genesis 194
genesis 195 strUsage += string() +
genesis 196 " -? \t\t " + _("This help message\n");
genesis 197
genesis 198 // Remove tabs
genesis 199 strUsage.erase(std::remove(strUsage.begin(), strUsage.end(), '\t'), strUsage.end());
genesis 200 fprintf(stderr, "%s", strUsage.c_str());
genesis 201 return false;
genesis 202 }
genesis 203
genesis 204 fDebug = GetBoolArg("-debug");
genesis 205 fDaemon = GetBoolArg("-daemon");
asciilifeform_and... 206 fCanEat = GetBoolArg("-caneat");
asciilifeform_add... 207 fVerifyAll = GetBoolArg("-verifyall");
mod6_der_high_low_s 208 fHighS = GetBoolArg("-highs");
mod6_der_high_low_s 209 fLowS = GetBoolArg("-lows");
mod6_der_high_low_s 210
mod6_der_high_low_s 211 if (fHighS && fLowS)
mod6_der_high_low_s 212 {
mod6_der_high_low_s 213 printf("Error: '-highs' and '-lows' can not be set at the same time.\n");
mod6_der_high_low_s 214 return false;
mod6_der_high_low_s 215 }
genesis 216
programmable-vers... 217 if (mapArgs.count("-setverstring"))
programmable-vers... 218 {
programmable-vers... 219 CLIENT_NAME = mapArgs["-setverstring"];
programmable-vers... 220 }
programmable-vers... 221
programmable-vers... 222 if (mapArgs.count("-setvernum"))
programmable-vers... 223 {
programmable-vers... 224 VERSION = atoi(mapArgs["-setvernum"]);
programmable-vers... 225 }
programmable-vers... 226
genesis 227 if (fDaemon)
genesis 228 fServer = true;
genesis 229 else
genesis 230 fServer = GetBoolArg("-server");
genesis 231
genesis 232 /* force fServer when running without GUI */
genesis 233 fServer = true;
genesis 234 fPrintToConsole = GetBoolArg("-printtoconsole");
genesis 235 fPrintToDebugger = GetBoolArg("-printtodebugger");
genesis 236 fLogTimestamps = GetBoolArg("-logtimestamps");
genesis 237
genesis 238 for (int i = 1; i < argc; i++)
genesis 239 if (!IsSwitchChar(argv[i][0]))
genesis 240 fCommandLine = true;
genesis 241
genesis 242 if (fCommandLine)
genesis 243 {
genesis 244 int ret = CommandLineRPC(argc, argv);
genesis 245 exit(ret);
genesis 246 }
genesis 247
genesis 248 if (fDaemon)
genesis 249 {
genesis 250 // Daemonize
genesis 251 pid_t pid = fork();
genesis 252 if (pid < 0)
genesis 253 {
genesis 254 fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
genesis 255 return false;
genesis 256 }
genesis 257 if (pid > 0)
genesis 258 {
genesis 259 CreatePidFile(GetPidFile(), pid);
genesis 260 return true;
genesis 261 }
genesis 262
genesis 263 pid_t sid = setsid();
genesis 264 if (sid < 0)
genesis 265 fprintf(stderr, "Error: setsid() returned %d errno %d\n", sid, errno);
genesis 266 }
genesis 267
genesis 268 if (!fDebug && !pszSetDataDir[0])
genesis 269 ShrinkDebugFile();
genesis 270 printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
genesis 271 printf("Bitcoin version %s\n", FormatFullVersion().c_str());
genesis 272 printf("Default data directory %s\n", GetDefaultDataDir().c_str());
genesis 273
genesis 274 if (GetBoolArg("-loadblockindextest"))
genesis 275 {
genesis 276 CTxDB txdb("r");
genesis 277 txdb.LoadBlockIndex();
genesis 278 PrintBlockTree();
genesis 279 return false;
genesis 280 }
genesis 281
genesis 282 // Make sure only a single bitcoin process is using the data directory.
genesis 283 string strLockFile = GetDataDir() + "/.lock";
genesis 284 FILE* file = fopen(strLockFile.c_str(), "a"); // empty lock file; created if it doesn't exist.
genesis 285 if (file) fclose(file);
genesis 286 static boost::interprocess::file_lock lock(strLockFile.c_str());
genesis 287 if (!lock.try_lock())
genesis 288 {
genesis 289 wxMessageBox(strprintf(_("Cannot obtain a lock on data directory %s. Bitcoin is probably already running."), GetDataDir().c_str()), "Bitcoin");
genesis 290 return false;
genesis 291 }
genesis 292
genesis 293 string strErrors;
genesis 294
genesis 295 //
genesis 296 // Load data files
genesis 297 //
genesis 298 if (fDaemon)
genesis 299 fprintf(stdout, "bitcoin server starting\n");
genesis 300 strErrors = "";
genesis 301 int64 nStart;
genesis 302
genesis 303 InitMessage(_("Loading addresses..."));
genesis 304 printf("Loading addresses...\n");
genesis 305 nStart = GetTimeMillis();
genesis 306 if (!LoadAddresses())
genesis 307 strErrors += _("Error loading addr.dat \n");
genesis 308 printf(" addresses %15"PRI64d"ms\n", GetTimeMillis() - nStart);
genesis 309
genesis 310 InitMessage(_("Loading block index..."));
genesis 311 printf("Loading block index...\n");
genesis 312 nStart = GetTimeMillis();
genesis 313 if (!LoadBlockIndex())
genesis 314 strErrors += _("Error loading blkindex.dat \n");
genesis 315 printf(" block index %15"PRI64d"ms\n", GetTimeMillis() - nStart);
genesis 316
genesis 317 InitMessage(_("Loading wallet..."));
genesis 318 printf("Loading wallet...\n");
genesis 319 nStart = GetTimeMillis();
genesis 320 bool fFirstRun;
genesis 321 pwalletMain = new CWallet("wallet.dat");
genesis 322 int nLoadWalletRet = pwalletMain->LoadWallet(fFirstRun);
genesis 323 if (nLoadWalletRet != DB_LOAD_OK)
genesis 324 {
genesis 325 if (nLoadWalletRet == DB_CORRUPT)
genesis 326 strErrors += _("Error loading wallet.dat: Wallet corrupted \n");
genesis 327 else if (nLoadWalletRet == DB_TOO_NEW)
genesis 328 strErrors += _("Error loading wallet.dat: Wallet requires newer version of Bitcoin \n");
genesis 329 else if (nLoadWalletRet == DB_NEED_REWRITE)
genesis 330 {
genesis 331 strErrors += _("Wallet needed to be rewritten: restart Bitcoin to complete \n");
genesis 332 wxMessageBox(strErrors, "Bitcoin", wxOK | wxICON_ERROR);
genesis 333 return false;
genesis 334 }
genesis 335 else
genesis 336 strErrors += _("Error loading wallet.dat \n");
genesis 337 }
genesis 338 printf(" wallet %15"PRI64d"ms\n", GetTimeMillis() - nStart);
genesis 339
genesis 340 RegisterWallet(pwalletMain);
genesis 341
genesis 342 CBlockIndex *pindexRescan = pindexBest;
genesis 343 if (GetBoolArg("-rescan"))
genesis 344 pindexRescan = pindexGenesisBlock;
genesis 345 else
genesis 346 {
genesis 347 CWalletDB walletdb("wallet.dat");
genesis 348 CBlockLocator locator;
genesis 349 if (walletdb.ReadBestBlock(locator))
genesis 350 pindexRescan = locator.GetBlockIndex();
genesis 351 }
genesis 352 if (pindexBest != pindexRescan)
genesis 353 {
genesis 354 InitMessage(_("Rescanning..."));
genesis 355 printf("Rescanning last %i blocks (from block %i)...\n", pindexBest->nHeight - pindexRescan->nHeight, pindexRescan->nHeight);
genesis 356 nStart = GetTimeMillis();
genesis 357 pwalletMain->ScanForWalletTransactions(pindexRescan, true);
genesis 358 printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart);
genesis 359 }
genesis 360
genesis 361 InitMessage(_("Done loading"));
genesis 362 printf("Done loading\n");
genesis 363
genesis 364 //// debug print
genesis 365 printf("mapBlockIndex.size() = %d\n", mapBlockIndex.size());
genesis 366 printf("nBestHeight = %d\n", nBestHeight);
genesis 367 printf("setKeyPool.size() = %d\n", pwalletMain->setKeyPool.size());
genesis 368 printf("mapWallet.size() = %d\n", pwalletMain->mapWallet.size());
genesis 369 printf("mapAddressBook.size() = %d\n", pwalletMain->mapAddressBook.size());
genesis 370
genesis 371 if (!strErrors.empty())
genesis 372 {
genesis 373 wxMessageBox(strErrors, "Bitcoin", wxOK | wxICON_ERROR);
genesis 374 return false;
genesis 375 }
genesis 376
genesis 377 // Add wallet transactions that aren't already in a block to mapTransactions
genesis 378 pwalletMain->ReacceptWalletTransactions();
genesis 379
genesis 380 // Note: Bitcoin-QT stores several settings in the wallet, so we want
genesis 381 // to load the wallet BEFORE parsing command-line arguments, so
genesis 382 // the command-line/bitcoin.conf settings override GUI setting.
genesis 383
genesis 384 //
genesis 385 // Parameters
genesis 386 //
genesis 387 if (GetBoolArg("-printblockindex") || GetBoolArg("-printblocktree"))
genesis 388 {
genesis 389 PrintBlockTree();
genesis 390 return false;
genesis 391 }
genesis 392
genesis 393 if (mapArgs.count("-timeout"))
genesis 394 {
genesis 395 int nNewTimeout = GetArg("-timeout", 5000);
genesis 396 if (nNewTimeout > 0 && nNewTimeout < 600000)
genesis 397 nConnectTimeout = nNewTimeout;
genesis 398 }
genesis 399
genesis 400 if (mapArgs.count("-printblock"))
genesis 401 {
genesis 402 string strMatch = mapArgs["-printblock"];
genesis 403 int nFound = 0;
genesis 404 for (map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi)
genesis 405 {
genesis 406 uint256 hash = (*mi).first;
genesis 407 if (strncmp(hash.ToString().c_str(), strMatch.c_str(), strMatch.size()) == 0)
genesis 408 {
genesis 409 CBlockIndex* pindex = (*mi).second;
genesis 410 CBlock block;
genesis 411 block.ReadFromDisk(pindex);
genesis 412 block.BuildMerkleTree();
genesis 413 block.print();
genesis 414 printf("\n");
genesis 415 nFound++;
genesis 416 }
genesis 417 }
genesis 418 if (nFound == 0)
genesis 419 printf("No blocks matching %s were found\n", strMatch.c_str());
genesis 420 return false;
genesis 421 }
genesis 422
genesis 423 fGenerateBitcoins = GetBoolArg("-gen");
genesis 424
genesis 425 if (mapArgs.count("-proxy"))
genesis 426 {
genesis 427 fUseProxy = true;
genesis 428 addrProxy = CAddress(mapArgs["-proxy"]);
genesis 429 if (!addrProxy.IsValid())
genesis 430 {
genesis 431 wxMessageBox(_("Invalid -proxy address"), "Bitcoin");
genesis 432 return false;
genesis 433 }
genesis 434 }
genesis 435
genesis 436 bool fTor = (fUseProxy && addrProxy.port == htons(9050));
genesis 437 if (fTor)
genesis 438 {
genesis 439 // Use SoftSetArg here so user can override any of these if they wish.
genesis 440 // Note: the GetBoolArg() calls for all of these must happen later.
genesis 441 SoftSetArg("-nolisten", true);
genesis 442 }
genesis 443
genesis 444 fNoListen = GetBoolArg("-nolisten");
genesis 445
genesis 446 // Command-line args override in-wallet settings:
genesis 447
genesis 448 if (!fNoListen)
genesis 449 {
genesis 450 if (!BindListenPort(strErrors))
genesis 451 {
genesis 452 wxMessageBox(strErrors, "Bitcoin");
genesis 453 return false;
genesis 454 }
genesis 455 }
genesis 456
asciilifeform_wir... 457 if (mapArgs.count("-wirerefresh"))
asciilifeform_wir... 458 {
asciilifeform_wir... 459 wireRefresh = atoi(mapArgs["-wirerefresh"]);
asciilifeform_wir... 460 }
asciilifeform_wir... 461
asciilifeform_wir... 462
asciilifeform_wir... 463 if (mapArgs.count("-addwire"))
asciilifeform_wir... 464 {
asciilifeform_wir... 465 BOOST_FOREACH(string strAddr, mapMultiArgs["-addwire"])
asciilifeform_wir... 466 {
asciilifeform_wir... 467 CAddress addr(strAddr);
asciilifeform_wir... 468 if (addr.IsValid()) {
asciilifeform_wir... 469 AddWire(addr);
asciilifeform_wir... 470 fWires = true;
asciilifeform_wir... 471 }
asciilifeform_wir... 472 }
asciilifeform_wir... 473 }
asciilifeform_wir... 474
genesis 475 if (mapArgs.count("-addnode"))
genesis 476 {
genesis 477 BOOST_FOREACH(string strAddr, mapMultiArgs["-addnode"])
genesis 478 {
asciilifeform_dns... 479 CAddress addr(strAddr);
genesis 480 addr.nTime = 0; // so it won't relay unless successfully connected
genesis 481 if (addr.IsValid())
genesis 482 AddAddress(addr);
genesis 483 }
genesis 484 }
genesis 485
genesis 486 if (mapArgs.count("-paytxfee"))
genesis 487 {
genesis 488 if (!ParseMoney(mapArgs["-paytxfee"], nTransactionFee))
genesis 489 {
genesis 490 wxMessageBox(_("Invalid amount for -paytxfee=<amount>"), "Bitcoin");
genesis 491 return false;
genesis 492 }
genesis 493 if (nTransactionFee > 0.25 * COIN)
genesis 494 wxMessageBox(_("Warning: -paytxfee is set very high. This is the transaction fee you will pay if you send a transaction."), "Bitcoin", wxOK | wxICON_EXCLAMATION);
genesis 495 }
genesis 496
genesis 497 //
genesis 498 // Start the node
genesis 499 //
genesis 500 if (!CheckDiskSpace())
genesis 501 return false;
genesis 502
genesis 503 RandAddSeedPerfmon();
genesis 504
genesis 505 if (!CreateThread(StartNode, NULL))
genesis 506 wxMessageBox(_("Error: CreateThread(StartNode) failed"), "Bitcoin");
genesis 507
genesis 508 if (fServer)
genesis 509 CreateThread(ThreadRPCServer, NULL);
genesis 510
genesis 511 while (1)
genesis 512 Sleep(5000);
genesis 513
genesis 514 return true;
genesis 515 }