diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index b6d8de4a1..84478398c 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -763,7 +763,8 @@ void ThreadRPCServer2(void* parg) else if (mapArgs.count("-daemon")) strWhatAmI = strprintf(_("To use the %s option"), "\"-daemon\""); uiInterface.ThreadSafeMessageBox(strprintf( - _("%s, you must set a rpcpassword in the configuration file:\n %s\n" + _("%s, you must set a rpcpassword in the configuration file:\n" + "%s\n" "It is recommended you use the following random password:\n" "rpcuser=bitcoinrpc\n" "rpcpassword=%s\n" diff --git a/src/init.cpp b/src/init.cpp index bb22b1d24..aac46d489 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1027,6 +1027,9 @@ bool AppInit2() if (fServer) NewThread(ThreadRPCServer, NULL); + // Generate coins in the background + GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain); + // ********************************************************* Step 12: finished uiInterface.InitMessage(_("Done loading")); diff --git a/src/main.cpp b/src/main.cpp index b29091b4f..60593c0d5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4764,3 +4764,29 @@ uint64 CTxOutCompressor::DecompressAmount(uint64 x) } return n; } + + +class CMainCleanup +{ +public: + CMainCleanup() {} + ~CMainCleanup() { + // block headers + std::map::iterator it1 = mapBlockIndex.begin(); + for (; it1 != mapBlockIndex.end(); it1++) + delete (*it1).second; + mapBlockIndex.clear(); + + // orphan blocks + std::map::iterator it2 = mapOrphanBlocks.begin(); + for (; it2 != mapOrphanBlocks.end(); it2++) + delete (*it2).second; + mapOrphanBlocks.clear(); + + // orphan transactions + std::map::iterator it3 = mapOrphanTransactions.begin(); + for (; it3 != mapOrphanTransactions.end(); it3++) + delete (*it3).second; + mapOrphanTransactions.clear(); + } +} instance_of_cmaincleanup; diff --git a/src/net.cpp b/src/net.cpp index 9ee6cb423..669f44b63 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -775,12 +775,12 @@ void ThreadSocketHandler(void* parg) printf("ThreadSocketHandler exited\n"); } +static list vNodesDisconnected; + void ThreadSocketHandler2(void* parg) { printf("ThreadSocketHandler started\n"); - list vNodesDisconnected; unsigned int nPrevNodeCount = 0; - loop { // @@ -2047,9 +2047,6 @@ void StartNode(void* parg) // Dump network addresses if (!NewThread(ThreadDumpAddress, NULL)) printf("Error; NewThread(ThreadDumpAddress) failed\n"); - - // Generate coins in the background - GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain); } bool StopNode() @@ -2088,6 +2085,7 @@ bool StopNode() Sleep(20); Sleep(50); DumpAddresses(); + return true; } @@ -2108,6 +2106,18 @@ public: if (closesocket(hListenSocket) == SOCKET_ERROR) printf("closesocket(hListenSocket) failed with error %d\n", WSAGetLastError()); + // clean up some globals (to help leak detection) + BOOST_FOREACH(CNode *pnode, vNodes) + delete pnode; + BOOST_FOREACH(CNode *pnode, vNodesDisconnected) + delete pnode; + vNodes.clear(); + vNodesDisconnected.clear(); + delete semOutbound; + semOutbound = NULL; + delete pnodeLocalHost; + pnodeLocalHost = NULL; + #ifdef WIN32 // Shutdown Windows Sockets WSACleanup(); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index e41ce9608..1c9094a88 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -167,14 +167,14 @@ void BitcoinGUI::createActions() overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1)); tabGroup->addAction(overviewAction); - sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this); + sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send"), this); sendCoinsAction->setStatusTip(tr("Send coins to a Bitcoin address")); sendCoinsAction->setToolTip(sendCoinsAction->statusTip()); sendCoinsAction->setCheckable(true); sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); tabGroup->addAction(sendCoinsAction); - receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this); + receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive"), this); receiveCoinsAction->setStatusTip(tr("Show the list of addresses for receiving payments")); receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip()); receiveCoinsAction->setCheckable(true); @@ -188,7 +188,7 @@ void BitcoinGUI::createActions() historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); tabGroup->addAction(historyAction); - addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this); + addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Addresses"), this); addressBookAction->setStatusTip(tr("Edit the list of stored addresses and labels")); addressBookAction->setToolTip(addressBookAction->statusTip()); addressBookAction->setCheckable(true); diff --git a/src/qt/bitcoinstrings.cpp b/src/qt/bitcoinstrings.cpp index 328e3af9e..2c500f4fe 100644 --- a/src/qt/bitcoinstrings.cpp +++ b/src/qt/bitcoinstrings.cpp @@ -8,14 +8,16 @@ static const char UNUSED *bitcoin_strings[] = { QT_TRANSLATE_NOOP("bitcoin-core", "" "%s, you must set a rpcpassword in the configuration file:\n" -" %s\n" +"%s\n" "It is recommended you use the following random password:\n" "rpcuser=bitcoinrpc\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"), +"permissions.\n" +"It is also recommended to set alertnotify so you are notified of problems;\n" +"for example: alertnotify=echo %%s | mail -s \"Bitcoin Alert\" admin@foo.com\n"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:" "@STRENGTH)"), @@ -41,6 +43,9 @@ QT_TRANSLATE_NOOP("bitcoin-core", "" "Error: This transaction requires a transaction fee of at least %s because of " "its amount, complexity, or use of recently received funds!"), QT_TRANSLATE_NOOP("bitcoin-core", "" +"Execute command when a relevant alert is received (%s in cmd is replaced by " +"message)"), +QT_TRANSLATE_NOOP("bitcoin-core", "" "Execute command when a wallet transaction changes (%s in cmd is replaced by " "TxID)"), QT_TRANSLATE_NOOP("bitcoin-core", "" @@ -129,7 +134,6 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write transaction index"), QT_TRANSLATE_NOOP("bitcoin-core", "Failed to write undo data"), QT_TRANSLATE_NOOP("bitcoin-core", "Fee per KB to add to transactions you send"), QT_TRANSLATE_NOOP("bitcoin-core", "Find peers using DNS lookup (default: 1 unless -connect)"), -QT_TRANSLATE_NOOP("bitcoin-core", "Find peers using internet relay chat (default: 0)"), QT_TRANSLATE_NOOP("bitcoin-core", "Generate coins"), QT_TRANSLATE_NOOP("bitcoin-core", "Get help for a command"), QT_TRANSLATE_NOOP("bitcoin-core", "How many blocks to check at startup (default: 288, 0 = all)"), diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 06ccde378..e56e40c20 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -160,8 +160,10 @@ void copyEntryData(QAbstractItemView *view, int column, int role) if(!selection.isEmpty()) { - // Copy first item - QApplication::clipboard()->setText(selection.at(0).data(role).toString(),QClipboard::Selection); + // Copy first item (global clipboard) + qApp->clipboard()->setText(selection.at(0).data(role).toString(), QClipboard::Clipboard); + // Copy first item (global mouse selection for e.g. X11 - NOP on Windows) + qApp->clipboard()->setText(selection.at(0).data(role).toString(), QClipboard::Selection); } } @@ -213,7 +215,7 @@ QString getSaveFileName(QWidget *parent, const QString &caption, Qt::ConnectionType blockingGUIThreadConnection() { - if(QThread::currentThread() != QCoreApplication::instance()->thread()) + if(QThread::currentThread() != qApp->thread()) { return Qt::BlockingQueuedConnection; } @@ -457,4 +459,3 @@ void HelpMessageBox::showOrPrint() } } // namespace GUIUtil - diff --git a/src/qt/locale/bitcoin_en.ts b/src/qt/locale/bitcoin_en.ts index 806a72655..c74b11d3d 100644 --- a/src/qt/locale/bitcoin_en.ts +++ b/src/qt/locale/bitcoin_en.ts @@ -310,17 +310,17 @@ This product includes software developed by the OpenSSL Project for use in the O BitcoinGUI - + Sign &message... Sign &message... - + Synchronizing with network... Synchronizing with network... - + &Overview &Overview @@ -340,32 +340,17 @@ This product includes software developed by the OpenSSL Project for use in the O Browse transaction history - - &Address Book - &Address Book - - - + Edit the list of stored addresses and labels Edit the list of stored addresses and labels - - &Receive coins - &Receive coins - - - + Show the list of addresses for receiving payments Show the list of addresses for receiving payments - - &Send coins - &Send coins - - - + E&xit E&xit @@ -410,7 +395,7 @@ This product includes software developed by the OpenSSL Project for use in the O &Change Passphrase... - + Importing blocks from disk... Importing blocks from disk... @@ -420,7 +405,7 @@ This product includes software developed by the OpenSSL Project for use in the O Reindexing blocks on disk... - + &Export... &Export... @@ -465,18 +450,33 @@ This product includes software developed by the OpenSSL Project for use in the O &Verify message... - - + + Bitcoin Bitcoin - + Wallet Wallet - + + &Send + &Send + + + + &Receive + &Receive + + + + &Addresses + &Addresses + + + &About Bitcoin &About Bitcoin @@ -537,12 +537,12 @@ This product includes software developed by the OpenSSL Project for use in the O [testnet] - + Bitcoin client Bitcoin client - + %n active connection(s) to Bitcoin network %n active connection to Bitcoin network @@ -619,17 +619,7 @@ This product includes software developed by the OpenSSL Project for use in the O This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee? - - Backup Successful - Backup Successful - - - - The wallet data was successfully saved to the new location. - The wallet data was successfully saved to the new location. - - - + Up to date Up to date @@ -644,7 +634,7 @@ This product includes software developed by the OpenSSL Project for use in the O Confirm transaction fee - + Sent transaction Sent transaction @@ -667,14 +657,14 @@ Address: %4 - - + + URI handling URI handling - - + + URI can not be parsed! This can be caused by an invalid Bitcoin address or malformed URI parameters. URI can not be parsed! This can be caused by an invalid Bitcoin address or malformed URI parameters. @@ -688,26 +678,6 @@ Address: %4 Wallet is <b>encrypted</b> and currently <b>locked</b> Wallet is <b>encrypted</b> and currently <b>locked</b> - - - Backup Wallet - Backup Wallet - - - - Wallet Data (*.dat) - Wallet Data (*.dat) - - - - Backup Failed - Backup Failed - - - - There was an error trying to save the wallet data to the new location. - There was an error trying to save the wallet data to the new location. - A fatal error occurred. Bitcoin can no longer continue safely and will quit. @@ -1052,23 +1022,18 @@ Address: %4 Form - - + + The displayed information may be out of date. Your wallet automatically synchronizes with the Bitcoin network after a connection is established, but this process has not completed yet. The displayed information may be out of date. Your wallet automatically synchronizes with the Bitcoin network after a connection is established, but this process has not completed yet. - + Balance: Balance: - - Number of transactions: - Number of transactions: - - - + Unconfirmed: Unconfirmed: @@ -1078,7 +1043,7 @@ Address: %4 Wallet - + Immature: Immature: @@ -1093,7 +1058,7 @@ Address: %4 <b>Recent transactions</b> - + Your current balance Your current balance @@ -1102,11 +1067,6 @@ Address: %4 Total of transactions that have yet to be confirmed, and do not yet count toward the current balance Total of transactions that have yet to be confirmed, and do not yet count toward the current balance - - - Total number of transactions in wallet - Total number of transactions in wallet - @@ -2102,6 +2062,11 @@ Address: %4 Copy amount Copy amount + + + Copy transaction ID + Copy transaction ID + Edit label @@ -2113,7 +2078,7 @@ Address: %4 Show transaction details - + Export Transaction Data Export Transaction Data @@ -2168,7 +2133,7 @@ Address: %4 Could not write to file %1. - + Range: Range: @@ -2178,15 +2143,158 @@ Address: %4 to + + WalletView + + + &Overview + &Overview + + + + Show general overview of wallet + Show general overview of wallet + + + + &Send coins + &Send coins + + + + Send coins to a Bitcoin address + Send coins to a Bitcoin address + + + + &Receive coins + &Receive coins + + + + Show the list of addresses for receiving payments + Show the list of addresses for receiving payments + + + + &Transactions + &Transactions + + + + Browse transaction history + Browse transaction history + + + + &Address Book + &Address Book + + + + Edit the list of stored addresses and labels + Edit the list of stored addresses and labels + + + + &Encrypt Wallet... + &Encrypt Wallet... + + + + Encrypt the private keys that belong to your wallet + Encrypt the private keys that belong to your wallet + + + + &Backup Wallet... + &Backup Wallet... + + + + Backup wallet to another location + Backup wallet to another location + + + + &Change Passphrase... + &Change Passphrase... + + + + Change the passphrase used for wallet encryption + Change the passphrase used for wallet encryption + + + + Sign &message... + Sign &message... + + + + Sign messages with your Bitcoin addresses to prove you own them + Sign messages with your Bitcoin addresses to prove you own them + + + + &Verify message... + &Verify message... + + + + Verify messages to ensure they were signed with specified Bitcoin addresses + Verify messages to ensure they were signed with specified Bitcoin addresses + + + + &Export... + &Export... + + + + Export the data in the current tab to a file + Export the data in the current tab to a file + + + + Backup Wallet + Backup Wallet + + + + Wallet Data (*.dat) + Wallet Data (*.dat) + + + + Backup Failed + Backup Failed + + + + There was an error trying to save the wallet data to the new location. + There was an error trying to save the wallet data to the new location. + + + + Backup Successful + Backup Successful + + + + The wallet data was successfully saved to the new location. + The wallet data was successfully saved to the new location. + + bitcoin-core - + Bitcoin version Bitcoin version - + Usage: Usage: @@ -2226,12 +2334,12 @@ Address: %4 Generate coins - + Don't generate coins Don't generate coins - + Specify data directory Specify data directory @@ -2251,12 +2359,12 @@ Address: %4 Maintain at most <n> connections to peers (default: 125) - + Connect to a node to retrieve peer addresses, and disconnect Connect to a node to retrieve peer addresses, and disconnect - + Specify your own public address Specify your own public address @@ -2266,17 +2374,17 @@ Address: %4 Threshold for disconnecting misbehaving peers (default: 100) - + Number of seconds to keep misbehaving peers from reconnecting (default: 86400) Number of seconds to keep misbehaving peers from reconnecting (default: 86400) - + An error occurred while setting up the RPC port %u for listening on IPv4: %s An error occurred while setting up the RPC port %u for listening on IPv4: %s - + Listen for JSON-RPC connections on <port> (default: 8332 or testnet: 18332) Listen for JSON-RPC connections on <port> (default: 8332 or testnet: 18332) @@ -2286,7 +2394,7 @@ Address: %4 Accept command line and JSON-RPC commands - + Run in the background as a daemon and accept commands Run in the background as a daemon and accept commands @@ -2296,32 +2404,37 @@ Address: %4 Use the test network - + Accept connections from outside (default: 1 if no -proxy or -connect) Accept connections from outside (default: 1 if no -proxy or -connect) - + %s, you must set a rpcpassword in the configuration file: - %s +%s It is recommended you use the following random password: rpcuser=bitcoinrpc rpcpassword=%s (you do not need to remember this password) The username and password MUST NOT be the same. If the file does not exist, create it with owner-readable-only file permissions. +It is also recommended to set alertnotify so you are notified of problems; +for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo.com %s, you must set a rpcpassword in the configuration file: - %s +%s It is recommended you use the following random password: rpcuser=bitcoinrpc rpcpassword=%s (you do not need to remember this password) The username and password MUST NOT be the same. -If the file does not exist, create it with owner-readable-only file permissions. +If the file does not exist, create it with owner-readable-only file permissions. +It is also recommended to set alertnotify so you are notified of problems; +for example: alertnotify=echo %%s | mail -s "Bitcoin Alert" admin@foo.com + - + An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s @@ -2350,6 +2463,11 @@ If the file does not exist, create it with owner-readable-only file permissions. Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds! Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds! + + + Execute command when a relevant alert is received (%s in cmd is replaced by message) + Execute command when a relevant alert is received (%s in cmd is replaced by message) + Execute command when a wallet transaction changes (%s in cmd is replaced by TxID) @@ -2526,7 +2644,7 @@ If the file does not exist, create it with owner-readable-only file permissions. Find peers using DNS lookup (default: 1 unless -connect) - + How many blocks to check at startup (default: 288, 0 = all) How many blocks to check at startup (default: 288, 0 = all) @@ -2538,7 +2656,7 @@ If the file does not exist, create it with owner-readable-only file permissions. Rebuild block chain index from current blk000??.dat files - + Rebuild block chain index from current blk000??.dat files @@ -2696,22 +2814,22 @@ If the file does not exist, create it with owner-readable-only file permissions. Password for JSON-RPC connections - + Allow JSON-RPC connections from specified IP address Allow JSON-RPC connections from specified IP address - + Send commands to node running on <ip> (default: 127.0.0.1) Send commands to node running on <ip> (default: 127.0.0.1) - + Execute command when the best block changes (%s in cmd is replaced by block hash) Execute command when the best block changes (%s in cmd is replaced by block hash) - + Upgrade wallet to latest format Upgrade wallet to latest format @@ -2741,12 +2859,12 @@ If the file does not exist, create it with owner-readable-only file permissions. Server private key (default: server.pem) - + Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH) Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH) - + This help message This help message @@ -2756,7 +2874,7 @@ If the file does not exist, create it with owner-readable-only file permissions. Unable to bind to %s on this computer (bind returned error %d, %s) - + Connect through socks proxy Connect through socks proxy @@ -2766,12 +2884,12 @@ If the file does not exist, create it with owner-readable-only file permissions. Allow DNS lookups for -addnode, -seednode and -connect - + Loading addresses... Loading addresses... - + Error loading wallet.dat: Wallet corrupted Error loading wallet.dat: Wallet corrupted @@ -2781,17 +2899,17 @@ If the file does not exist, create it with owner-readable-only file permissions. Error loading wallet.dat: Wallet requires newer version of Bitcoin - + Wallet needed to be rewritten: restart Bitcoin to complete Wallet needed to be rewritten: restart Bitcoin to complete - + Error loading wallet.dat Error loading wallet.dat - + Invalid -proxy address: '%s' Invalid -proxy address: '%s' @@ -2806,7 +2924,7 @@ If the file does not exist, create it with owner-readable-only file permissions. Unknown -socks proxy version requested: %i - + Cannot resolve -bind address: '%s' Cannot resolve -bind address: '%s' @@ -2816,17 +2934,17 @@ If the file does not exist, create it with owner-readable-only file permissions. Cannot resolve -externalip address: '%s' - + Invalid amount for -paytxfee=<amount>: '%s' Invalid amount for -paytxfee=<amount>: '%s' - + Error: could not start node Error: could not start node - + Invalid amount Invalid amount @@ -2841,7 +2959,7 @@ If the file does not exist, create it with owner-readable-only file permissions. Loading block index... - + Add a node to connect to and attempt to keep the connection open Add a node to connect to and attempt to keep the connection open @@ -2851,22 +2969,17 @@ If the file does not exist, create it with owner-readable-only file permissions. Unable to bind to %s on this computer. Bitcoin is probably already running. - - Find peers using internet relay chat (default: 0) - Find peers using internet relay chat (default: 0) - - - + Fee per KB to add to transactions you send Fee per KB to add to transactions you send - + Loading wallet... Loading wallet... - + Cannot downgrade wallet Cannot downgrade wallet @@ -2881,22 +2994,22 @@ If the file does not exist, create it with owner-readable-only file permissions. Cannot write default address - + Rescanning... Rescanning... - + Done loading Done loading - + To use the %s option To use the %s option - + Error Error