From: Wladimir J. van der Laan Date: Mon, 16 Apr 2012 07:55:37 +0000 (-0700) Subject: Merge pull request #1091 from Diapolo/GUI-BlockDL X-Git-Tag: v0.4.0-unstable~129^2~71 X-Git-Url: https://git.novaco.in/?a=commitdiff_plain;h=088a13331bd85a54a1cb39aeb8699a36c1e5de98;hp=e72c6a18305903a5d6660d710875aa6bd4f590ec;p=novacoin.git Merge pull request #1091 from Diapolo/GUI-BlockDL revert to default OS theme for progressbar (fix #1071) --- diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index a3b42cd..14ee947 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -90,8 +90,7 @@ contains(BITCOIN_NEED_QT_PLUGINS, 1) { DEFINES += HAVE_BUILD_INFO } -# disable quite some warnings because bitcoin core "sins" a lot -QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wno-strict-aliasing -Wno-invalid-offsetof -Wno-unused-variable -Wno-unused-parameter -Wno-sign-compare -Wno-char-subscripts -Wno-unused-value -Wno-sequence-point -Wno-parentheses -Wno-unknown-pragmas -Wno-switch +QMAKE_CXXFLAGS_WARN_ON = -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-invalid-offsetof -Wno-sign-compare -Wno-unused-parameter # Input DEPENDPATH += src/qt src src json/include diff --git a/scripts/qt/extract_strings_qt.py b/share/qt/extract_strings_qt.py similarity index 75% rename from scripts/qt/extract_strings_qt.py rename to share/qt/extract_strings_qt.py index 6627de4..771f28a 100755 --- a/scripts/qt/extract_strings_qt.py +++ b/share/qt/extract_strings_qt.py @@ -4,6 +4,7 @@ Extract _("...") strings for translation and convert to Qt4 stringdefs so that they can be picked up by Qt linguist. ''' from subprocess import Popen, PIPE +import glob OUT_CPP="src/qt/bitcoinstrings.cpp" EMPTY=['""'] @@ -44,7 +45,7 @@ def parse_po(text): return messages -files = ['src/base58.h', 'src/bignum.h', 'src/db.cpp', 'src/db.h', 'src/headers.h', 'src/init.cpp', 'src/init.h', 'src/irc.cpp', 'src/irc.h', 'src/key.h', 'src/main.cpp', 'src/main.h', 'src/net.cpp', 'src/net.h', 'src/noui.h', 'src/script.cpp', 'src/script.h', 'src/serialize.h', 'src/strlcpy.h', 'src/uint256.h', 'src/util.cpp', 'src/util.h'] +files = glob.glob('src/*.cpp') + glob.glob('src/*.h') # xgettext -n --keyword=_ $FILES child = Popen(['xgettext','--output=-','-n','--keyword=_'] + files, stdout=PIPE) @@ -53,9 +54,15 @@ child = Popen(['xgettext','--output=-','-n','--keyword=_'] + files, stdout=PIPE) messages = parse_po(out) f = open(OUT_CPP, 'w') -f.write('#include \n') -f.write('// Automatically generated by extract_strings.py\n') -f.write('static const char *bitcoin_strings[] = {') +f.write("""#include +// Automatically generated by extract_strings.py +#ifdef __GNUC__ +#define UNUSED __attribute__((unused)) +#else +#define UNUSED +#endif +""") +f.write('static const char UNUSED *bitcoin_strings[] = {') for (msgid, msgstr) in messages: if msgid != EMPTY: f.write('QT_TRANSLATE_NOOP("bitcoin-core", %s),\n' % ('\n'.join(msgid))) diff --git a/scripts/qt/make_spinner.py b/share/qt/make_spinner.py similarity index 100% rename from scripts/qt/make_spinner.py rename to share/qt/make_spinner.py diff --git a/scripts/qt/make_windows_icon.py b/share/qt/make_windows_icon.sh similarity index 100% rename from scripts/qt/make_windows_icon.py rename to share/qt/make_windows_icon.sh diff --git a/src/addrman.cpp b/src/addrman.cpp index 2ef666c..8fb40b4 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -312,7 +312,7 @@ bool CAddrMan::Add_(const CAddress &addr, const CNetAddr& source, int64 nTimePen pinfo->nServices |= addr.nServices; // do not update if no new information is present - if (!addr.nTime || pinfo->nTime && addr.nTime <= pinfo->nTime) + if (!addr.nTime || (pinfo->nTime && addr.nTime <= pinfo->nTime)) return false; // do not update if the entry was already in the "tried" table diff --git a/src/base58.h b/src/base58.h index 755e34c..7fefbc5 100644 --- a/src/base58.h +++ b/src/base58.h @@ -396,6 +396,16 @@ public: return fExpectTestNet == fTestNet && (vchData.size() == 32 || (vchData.size() == 33 && vchData[32] == 1)); } + bool SetString(const char* pszSecret) + { + return CBase58Data::SetString(pszSecret) && IsValid(); + } + + bool SetString(const std::string& strSecret) + { + return SetString(strSecret.c_str()); + } + CBitcoinSecret(const CSecret& vchSecret, bool fCompressed) { SetSecret(vchSecret, fCompressed); diff --git a/src/bignum.h b/src/bignum.h index 95e2197..daf5f68 100644 --- a/src/bignum.h +++ b/src/bignum.h @@ -301,7 +301,7 @@ public: while (isxdigit(*psz)) { *this <<= 4; - int n = phexdigit[*psz++]; + int n = phexdigit[(unsigned char)*psz++]; *this += n; } if (fNegative) diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 7c99114..63c51ad 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -796,8 +796,10 @@ Value getbalance(const Array& params, bool fHelp) list > listSent; wtx.GetAmounts(allGeneratedImmature, allGeneratedMature, listReceived, listSent, allFee, strSentAccount); if (wtx.GetDepthInMainChain() >= nMinDepth) + { BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress,int64)& r, listReceived) nBalance += r.second; + } BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress,int64)& r, listSent) nBalance -= r.second; nBalance -= allFee; @@ -1228,6 +1230,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe // Received if (listReceived.size() > 0 && wtx.GetDepthInMainChain() >= nMinDepth) + { BOOST_FOREACH(const PAIRTYPE(CBitcoinAddress, int64)& r, listReceived) { string account; @@ -1245,6 +1248,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe ret.push_back(entry); } } + } } void AcentryToJSON(const CAccountingEntry& acentry, const string& strAccount, Array& ret) diff --git a/src/db.cpp b/src/db.cpp index 839c080..2d13691 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -642,6 +642,7 @@ bool CTxDB::LoadBlockIndex() // check level 4: check whether spent txouts were spent within the main chain int nOutput = 0; if (nCheckLevel>3) + { BOOST_FOREACH(const CDiskTxPos &txpos, txindex.vSpent) { if (!txpos.IsNull()) @@ -682,9 +683,11 @@ bool CTxDB::LoadBlockIndex() } nOutput++; } + } } // check level 5: check whether all prevouts are marked spent if (nCheckLevel>4) + { BOOST_FOREACH(const CTxIn &txin, tx.vin) { CTxIndex txindex; @@ -695,6 +698,7 @@ bool CTxDB::LoadBlockIndex() pindexFork = pindex->pprev; } } + } } } } diff --git a/src/keystore.h b/src/keystore.h index 282eaaa..5d29ac1 100644 --- a/src/keystore.h +++ b/src/keystore.h @@ -15,6 +15,8 @@ protected: mutable CCriticalSection cs_KeyStore; public: + virtual ~CKeyStore() {} + // Add a key to the store. virtual bool AddKey(const CKey& key) =0; diff --git a/src/main.cpp b/src/main.cpp index bdafae8..f293280 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -592,12 +592,6 @@ bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMi return true; } -bool CTransaction::AcceptToMemoryPool(bool fCheckInputs, bool* pfMissingInputs) -{ - CTxDB txdb("r"); - return AcceptToMemoryPool(txdb, fCheckInputs, pfMissingInputs); -} - uint64 nPooledTx = 0; bool CTransaction::AddToMemoryPoolUnchecked() @@ -1267,14 +1261,18 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex) // This rule applies to all blocks whose timestamp is after March 15, 2012, 0:00 UTC. // On testnet it is enabled as of februari 20, 2012, 0:00 UTC. if (pindex->nTime > 1331769600 || (fTestNet && pindex->nTime > 1329696000)) + { BOOST_FOREACH(CTransaction& tx, vtx) { CTxIndex txindexOld; if (txdb.ReadTxIndex(tx.GetHash(), txindexOld)) + { BOOST_FOREACH(CDiskTxPos &pos, txindexOld.vSpent) if (pos.IsNull()) return false; + } } + } // BIP16 didn't become active until Apr 1 2012 (Feb 15 on testnet) int64 nBIP16SwitchTime = fTestNet ? 1329264000 : 1333238400; @@ -2522,6 +2520,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) { vector vWorkQueue; CDataStream vMsg(vRecv); + CTxDB txdb("r"); CTransaction tx; vRecv >> tx; @@ -2529,7 +2528,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) pfrom->AddInventoryKnown(inv); bool fMissingInputs = false; - if (tx.AcceptToMemoryPool(true, &fMissingInputs)) + if (tx.AcceptToMemoryPool(txdb, true, &fMissingInputs)) { SyncWithWallets(tx, NULL, true); RelayMessage(inv, vMsg); @@ -2549,7 +2548,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) CDataStream(vMsg) >> tx; CInv inv(MSG_TX, tx.GetHash()); - if (tx.AcceptToMemoryPool(true)) + if (tx.AcceptToMemoryPool(txdb, true)) { printf(" accepted orphan tx %s\n", inv.hash.ToString().substr(0,10).c_str()); SyncWithWallets(tx, NULL, true); diff --git a/src/main.h b/src/main.h index 1d46851..a89c093 100644 --- a/src/main.h +++ b/src/main.h @@ -573,9 +573,11 @@ public: // To limit dust spam, require MIN_TX_FEE/MIN_RELAY_TX_FEE if any output is less than 0.01 if (nMinFee < nBaseFee) + { BOOST_FOREACH(const CTxOut& txout, vout) if (txout.nValue < CENT) nMinFee = nBaseFee; + } // Raise the price as the block approaches full if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2) @@ -684,7 +686,6 @@ public: bool ClientConnectInputs(); bool CheckTransaction() const; bool AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs=true, bool* pfMissingInputs=NULL); - bool AcceptToMemoryPool(bool fCheckInputs=true, bool* pfMissingInputs=NULL); protected: const CTxOut& GetOutputFor(const CTxIn& input, const MapPrevTx& inputs) const; diff --git a/src/makefile.osx b/src/makefile.osx index c5d3edb..e2e35de 100644 --- a/src/makefile.osx +++ b/src/makefile.osx @@ -62,7 +62,7 @@ CFLAGS = -g endif # ppc doesn't work because we don't support big-endian -CFLAGS += -Wextra -Wno-sign-compare -Wno-char-subscripts -Wno-invalid-offsetof -Wformat-security \ +CFLAGS += -Wextra -Wno-sign-compare -Wno-invalid-offsetof -Wformat-security \ $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) OBJS= \ diff --git a/src/makefile.unix b/src/makefile.unix index 79251dc..9bc780d 100644 --- a/src/makefile.unix +++ b/src/makefile.unix @@ -81,7 +81,7 @@ LIBS+= \ DEBUGFLAGS=-g CXXFLAGS=-O2 -xCXXFLAGS=-pthread -Wextra -Wno-sign-compare -Wno-char-subscripts -Wno-invalid-offsetof -Wformat -Wformat-security \ +xCXXFLAGS=-pthread -Wall -Wextra -Wno-sign-compare -Wno-invalid-offsetof -Wno-unused-parameter -Wformat -Wformat-security \ $(DEBUGFLAGS) $(DEFS) $(HARDENING) $(CXXFLAGS) OBJS= \ diff --git a/src/net.cpp b/src/net.cpp index 8272b25..b0f3650 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1233,8 +1233,6 @@ void ThreadOpenConnections2(void* parg) if (fShutdown) return; - bool fAddSeeds = false; - // Add seed nodes if IRC isn't working bool fTOR = (fUseProxy && addrProxy.GetPort() == 9050); if (addrman.size()==0 && (GetTime() - nStart > 60 || fTOR) && !fTestNet) @@ -1260,7 +1258,6 @@ void ThreadOpenConnections2(void* parg) // Choose an address to connect to based on most recently seen // CAddress addrConnect; - int64 nBest = std::numeric_limits::min(); // Only connect to one address per a.b.?.? range. // Do this here so we don't have to critsect vNodes inside mapAddresses critsect. diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index 05f3a81..0239a16 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -27,8 +27,9 @@ struct AddressTableEntry }; // Private implementation -struct AddressTablePriv +class AddressTablePriv { +public: CWallet *wallet; QList cachedAddressTable; diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index bfb49cb..463b2cf 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -119,6 +119,15 @@ std::string _(const char* psz) return QCoreApplication::translate("bitcoin-core", psz).toStdString(); } +/* Handle runaway exceptions. Shows a message box with the problem and quits the program. + */ +static void handleRunawayException(std::exception *e) +{ + PrintExceptionContinue(e, "Runaway exception"); + QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occured. Bitcoin can no longer continue safely and will quit.") + QString("\n\n") + QString::fromStdString(strMiscWarning)); + exit(1); +} + #ifdef WIN32 #define strncasecmp strnicmp #endif @@ -284,9 +293,9 @@ int main(int argc, char *argv[]) return 1; } } catch (std::exception& e) { - PrintException(&e, "Runaway exception"); + handleRunawayException(&e); } catch (...) { - PrintException(NULL, "Runaway exception"); + handleRunawayException(NULL); } return 0; } diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index cf24857..bcf9091 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -238,7 +238,7 @@ void BitcoinGUI::createActions() optionsAction->setToolTip(tr("Modify configuration options for bitcoin")); optionsAction->setMenuRole(QAction::PreferencesRole); toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("Show/Hide &Bitcoin"), this); - toggleHideAction->setToolTip(tr("Show or Hide the Bitcoin window")); + toggleHideAction->setToolTip(tr("Show or hide the Bitcoin window")); exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this); exportAction->setToolTip(tr("Export the data in the current tab to a file")); encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet"), this); @@ -549,7 +549,7 @@ void BitcoinGUI::setNumBlocks(int count) } // Set icon state: spinning if catching up, tick otherwise - if(secs < 90*60) + if(secs < 90*60 && count >= nTotalBlocks) { tooltip = tr("Up to date") + QString(".\n") + tooltip; labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); diff --git a/src/qt/bitcoinstrings.cpp b/src/qt/bitcoinstrings.cpp index 73db1fe..b25af1a 100644 --- a/src/qt/bitcoinstrings.cpp +++ b/src/qt/bitcoinstrings.cpp @@ -1,6 +1,15 @@ #include // Automatically generated by extract_strings.py -static const char *bitcoin_strings[] = {QT_TRANSLATE_NOOP("bitcoin-core", "Bitcoin version"), +#ifdef __GNUC__ +#define UNUSED __attribute__((unused)) +#else +#define UNUSED +#endif +static const char UNUSED *bitcoin_strings[] = {QT_TRANSLATE_NOOP("bitcoin-core", "" +"Unable to bind to port %d on this computer. Bitcoin is probably already " +"running."), +QT_TRANSLATE_NOOP("bitcoin-core", "Warning: Disk space is low "), +QT_TRANSLATE_NOOP("bitcoin-core", "Bitcoin version"), QT_TRANSLATE_NOOP("bitcoin-core", "Usage:"), QT_TRANSLATE_NOOP("bitcoin-core", "Send command to -server or bitcoind"), QT_TRANSLATE_NOOP("bitcoin-core", "List commands"), @@ -11,25 +20,30 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Specify pid file (default: bitcoind.pid)"), QT_TRANSLATE_NOOP("bitcoin-core", "Generate coins"), QT_TRANSLATE_NOOP("bitcoin-core", "Don't generate coins"), QT_TRANSLATE_NOOP("bitcoin-core", "Start minimized"), +QT_TRANSLATE_NOOP("bitcoin-core", "Show splash screen on startup (default: 1)"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify data directory"), +QT_TRANSLATE_NOOP("bitcoin-core", "Set database cache size in megabytes (default: 25)"), +QT_TRANSLATE_NOOP("bitcoin-core", "Set database disk log size in megabytes (default: 100)"), QT_TRANSLATE_NOOP("bitcoin-core", "Specify connection timeout (in milliseconds)"), QT_TRANSLATE_NOOP("bitcoin-core", "Connect through socks4 proxy"), QT_TRANSLATE_NOOP("bitcoin-core", "Allow DNS lookups for addnode and connect"), QT_TRANSLATE_NOOP("bitcoin-core", "Listen for connections on (default: 8333 or testnet: 18333)"), QT_TRANSLATE_NOOP("bitcoin-core", "Maintain at most connections to peers (default: 125)"), -QT_TRANSLATE_NOOP("bitcoin-core", "Add a node to connect to"), +QT_TRANSLATE_NOOP("bitcoin-core", "Add a node to connect to and attempt to keep the connection open"), QT_TRANSLATE_NOOP("bitcoin-core", "Connect only to the specified node"), -QT_TRANSLATE_NOOP("bitcoin-core", "Don't accept connections from outside"), -QT_TRANSLATE_NOOP("bitcoin-core", "Don't bootstrap list of peers using DNS"), +QT_TRANSLATE_NOOP("bitcoin-core", "Find peers using internet relay chat (default: 0)"), +QT_TRANSLATE_NOOP("bitcoin-core", "Accept connections from outside (default: 1)"), +QT_TRANSLATE_NOOP("bitcoin-core", "Set language, for example \"de_DE\" (default: system locale)"), +QT_TRANSLATE_NOOP("bitcoin-core", "Find peers using DNS lookup (default: 1)"), QT_TRANSLATE_NOOP("bitcoin-core", "Threshold for disconnecting misbehaving peers (default: 100)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Number of seconds to keep misbehaving peers from reconnecting (default: " "86400)"), QT_TRANSLATE_NOOP("bitcoin-core", "Maximum per-connection receive buffer, *1000 bytes (default: 10000)"), QT_TRANSLATE_NOOP("bitcoin-core", "Maximum per-connection send buffer, *1000 bytes (default: 10000)"), -QT_TRANSLATE_NOOP("bitcoin-core", "Don't attempt to use UPnP to map the listening port"), -QT_TRANSLATE_NOOP("bitcoin-core", "Attempt to use UPnP to map the listening port"), -QT_TRANSLATE_NOOP("bitcoin-core", "Fee per kB to add to transactions you send"), +QT_TRANSLATE_NOOP("bitcoin-core", "Use Universal Plug and Play to map the listening port (default: 1)"), +QT_TRANSLATE_NOOP("bitcoin-core", "Use Universal Plug and Play to map the listening port (default: 0)"), +QT_TRANSLATE_NOOP("bitcoin-core", "Fee per KB to add to transactions you send"), QT_TRANSLATE_NOOP("bitcoin-core", "Accept command line and JSON-RPC commands"), QT_TRANSLATE_NOOP("bitcoin-core", "Run in the background as a daemon and accept commands"), QT_TRANSLATE_NOOP("bitcoin-core", "Use the test network"), @@ -42,8 +56,14 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Password for JSON-RPC connections"), QT_TRANSLATE_NOOP("bitcoin-core", "Listen for JSON-RPC connections on (default: 8332)"), QT_TRANSLATE_NOOP("bitcoin-core", "Allow JSON-RPC connections from specified IP address"), QT_TRANSLATE_NOOP("bitcoin-core", "Send commands to node running on (default: 127.0.0.1)"), +QT_TRANSLATE_NOOP("bitcoin-core", "" +"Execute command when the best block changes (%s in cmd is replaced by block " +"hash)"), +QT_TRANSLATE_NOOP("bitcoin-core", "Upgrade wallet to latest format"), QT_TRANSLATE_NOOP("bitcoin-core", "Set key pool size to (default: 100)"), QT_TRANSLATE_NOOP("bitcoin-core", "Rescan the block chain for missing wallet transactions"), +QT_TRANSLATE_NOOP("bitcoin-core", "How many blocks to check at startup (default: 2500, 0 = all)"), +QT_TRANSLATE_NOOP("bitcoin-core", "How thorough the block verification is (0-6, default: 1)"), QT_TRANSLATE_NOOP("bitcoin-core", "" "\n" "SSL options: (see the Bitcoin Wiki for SSL setup instructions)"), @@ -54,9 +74,11 @@ QT_TRANSLATE_NOOP("bitcoin-core", "" "Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:" "@STRENGTH)"), QT_TRANSLATE_NOOP("bitcoin-core", "This help message"), +QT_TRANSLATE_NOOP("bitcoin-core", "Usage"), QT_TRANSLATE_NOOP("bitcoin-core", "" "Cannot obtain a lock on data directory %s. Bitcoin is probably already " "running."), +QT_TRANSLATE_NOOP("bitcoin-core", "Bitcoin"), QT_TRANSLATE_NOOP("bitcoin-core", "Loading addresses..."), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading addr.dat"), QT_TRANSLATE_NOOP("bitcoin-core", "Loading block index..."), @@ -66,6 +88,9 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet corrupted"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet requires newer version of Bitcoin"), QT_TRANSLATE_NOOP("bitcoin-core", "Wallet needed to be rewritten: restart Bitcoin to complete"), QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat"), +QT_TRANSLATE_NOOP("bitcoin-core", "Cannot downgrade wallet"), +QT_TRANSLATE_NOOP("bitcoin-core", "Cannot initialize keypool"), +QT_TRANSLATE_NOOP("bitcoin-core", "Cannot write default address"), QT_TRANSLATE_NOOP("bitcoin-core", "Rescanning..."), QT_TRANSLATE_NOOP("bitcoin-core", "Done loading"), QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -proxy address"), @@ -74,12 +99,36 @@ QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: -paytxfee is set very high. This is the transaction fee you will " "pay if you send a transaction."), QT_TRANSLATE_NOOP("bitcoin-core", "Error: CreateThread(StartNode) failed"), -QT_TRANSLATE_NOOP("bitcoin-core", "Warning: Disk space is low "), +QT_TRANSLATE_NOOP("bitcoin-core", "To use the %s option"), QT_TRANSLATE_NOOP("bitcoin-core", "" -"Unable to bind to port %d on this computer. Bitcoin is probably already " -"running."), +"%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" +"(you do not need to remember this password)\n" +"If the file does not exist, create it with owner-readable-only file " +"permissions.\n"), +QT_TRANSLATE_NOOP("bitcoin-core", "Error"), +QT_TRANSLATE_NOOP("bitcoin-core", "An error occured while setting up the RPC port %i for listening: %s"), +QT_TRANSLATE_NOOP("bitcoin-core", "" +"You must set rpcpassword= in the configuration file:\n" +"%s\n" +"If the file does not exist, create it with owner-readable-only file " +"permissions."), QT_TRANSLATE_NOOP("bitcoin-core", "" "Warning: Please check that your computer's date and time are correct. If " "your clock is wrong Bitcoin will not work properly."), -QT_TRANSLATE_NOOP("bitcoin-core", "beta"), -}; +QT_TRANSLATE_NOOP("bitcoin-core", "Error: Wallet locked, unable to create transaction "), +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", "Error: Transaction creation failed "), +QT_TRANSLATE_NOOP("bitcoin-core", "Sending..."), +QT_TRANSLATE_NOOP("bitcoin-core", "" +"Error: The transaction was rejected. This might happen if some of the coins " +"in your wallet were already spent, such as if you used a copy of wallet.dat " +"and coins were spent in the copy but not marked as spent here."), +QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount"), +QT_TRANSLATE_NOOP("bitcoin-core", "Insufficient funds"), +}; \ No newline at end of file diff --git a/src/qt/editaddressdialog.cpp b/src/qt/editaddressdialog.cpp index 8cc3c85..cecb8ae 100644 --- a/src/qt/editaddressdialog.cpp +++ b/src/qt/editaddressdialog.cpp @@ -106,6 +106,9 @@ void EditAddressDialog::accept() tr("New key generation failed."), QMessageBox::Ok, QMessageBox::Ok); return; + case AddressTableModel::OK: + // Failed with unknown reason. Just reject. + break; } return; diff --git a/src/qt/locale/bitcoin_en.ts b/src/qt/locale/bitcoin_en.ts index d83d4bc..53ba23b 100644 --- a/src/qt/locale/bitcoin_en.ts +++ b/src/qt/locale/bitcoin_en.ts @@ -1,6 +1,6 @@ - + UTF-8 AboutDialog @@ -15,7 +15,7 @@ - + Copyright © 2009-2012 Bitcoin Developers This is experimental software. @@ -89,42 +89,42 @@ This product includes software developed by the OpenSSL Project for use in the O - + Copy address - + Copy label - + Edit - + Delete - + Export Address Book Data - + Comma separated file (*.csv) - + Error exporting - + Could not write to file %1. @@ -288,293 +288,300 @@ Are you sure you wish to encrypt your wallet? BitcoinGUI - + Bitcoin Wallet - - - Synchronizing with network... + + Show/Hide &Bitcoin - - Block chain synchronization in progress + + Synchronizing with network... - + &Overview - + Show general overview of wallet - + &Transactions - + Browse transaction history - + &Address Book - + Edit the list of stored addresses and labels - + &Receive coins - + Show the list of addresses for receiving payments - + &Send coins - + Send coins to a bitcoin address - + Sign &message - + Prove you control an address - + E&xit - + Quit application - + &About %1 - + Show information about Bitcoin - + About &Qt - + Show information about Qt - + &Options... - + Modify configuration options for bitcoin + + + ~%n block(s) remaining + + ~%n block remaining + ~%n blocks remaining + + - - Open &Bitcoin + + Downloaded %1 of %2 blocks of transaction history (%3% done). - - Show the Bitcoin window + + &Export... - - &Export... + + Show or hide the Bitcoin window - + Export the data in the current tab to a file - + &Encrypt Wallet - + Encrypt or decrypt wallet - + &Backup Wallet - + Backup wallet to another location - + &Change Passphrase - + Change the passphrase used for wallet encryption - + &File - + &Settings - + &Help - + Tabs toolbar - + Actions toolbar - + [testnet] - + + Bitcoin client + + + + bitcoin-qt - + %n active connection(s) to Bitcoin network - + %n active connection to Bitcoin network %n active connections to Bitcoin network - - Downloaded %1 of %2 blocks of transaction history. - - - - + Downloaded %1 blocks of transaction history. - + %n second(s) ago - + %n second ago %n seconds ago - + %n minute(s) ago - + %n minute ago %n minutes ago - + %n hour(s) ago - + %n hour ago %n hours ago - + %n day(s) ago - + %n day ago %n days ago - + Up to date - + Catching up... - + Last received block was generated %1. - + 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? - + Sending... - + Sent transaction - + Incoming transaction - + Date: %1 Amount: %2 Type: %3 @@ -583,32 +590,32 @@ Address: %4 - + Wallet is <b>encrypted</b> and currently <b>unlocked</b> - + Wallet is <b>encrypted</b> and currently <b>locked</b> - + Backup Wallet - + Wallet Data (*.dat) - + Backup Failed - + There was an error trying to save the wallet data to the new location. @@ -616,17 +623,17 @@ Address: %4 DisplayOptionsPage - + &Unit to show amounts in: - + Choose the default subdivision unit to show in the interface, and when sending coins - + Display addresses in transaction list @@ -722,67 +729,67 @@ Address: %4 - + Map port using &UPnP - + Automatically open the Bitcoin client port on the router. This only works when your router supports UPnP and it is enabled. - + M&inimize on close - + Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu. - + &Connect through SOCKS4 proxy: - + Connect to the Bitcon network through a SOCKS4 proxy (e.g. when connecting through Tor) - + Proxy &IP: - + IP address of the proxy (e.g. 127.0.0.1) - + &Port: - + Port of the proxy (e.g. 1234) - + Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended. - + Pay transaction &fee - + Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended. @@ -801,7 +808,7 @@ Address: %4 - The address to send the payment to (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L) + The address to sign the message with (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L) @@ -975,42 +982,47 @@ p, li { white-space: pre-wrap; } - + Request Payment - + Amount: - + BTC - + Label: - + Message: - + &Save As... - + + Resulting URI too long, try to reduce the text for label / message. + + + + Save Image... - + PNG Images (*.png) @@ -1217,115 +1229,115 @@ p, li { white-space: pre-wrap; } - + <b>Status:</b> - + , has not been successfully broadcast yet - + , broadcast through %1 node - + , broadcast through %1 nodes - + <b>Date:</b> - + <b>Source:</b> Generated<br> - - + + <b>From:</b> - + unknown - - - + + + <b>To:</b> - + (yours, label: - + (yours) - - - - + + + + <b>Credit:</b> - + (%1 matures in %2 more blocks) - + (not accepted) - - - + + + <b>Debit:</b> - + <b>Transaction fee:</b> - + <b>Net amount:</b> - + Message: - + Comment: - + Transaction ID: - + Generated coins must wait 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, it will change to "not accepted" and not be spendable. This may occasionally happen if another node generates a block within a few seconds of yours. @@ -1368,7 +1380,7 @@ p, li { white-space: pre-wrap; } Open for %n block(s) - + Open for %n block Open for %n blocks @@ -1394,75 +1406,75 @@ p, li { white-space: pre-wrap; } - + Mined balance will be available in %n more blocks - + Mined balance will be available in %n more block Mined balance will be available in %n more blocks - + This block was not received by any other nodes and will probably not be accepted! - + Generated but not accepted - + Received with - + Received from - + Sent to - + Payment to yourself - + Mined - + (n/a) - + Transaction status. Hover over this field to show number of confirmations. - + Date and time that the transaction was received. - + Type of transaction. - + Destination address of transaction. - + Amount removed from or added to balance. @@ -1634,7 +1646,7 @@ p, li { white-space: pre-wrap; } WalletModel - + Sending... @@ -1642,344 +1654,478 @@ p, li { white-space: pre-wrap; } bitcoin-core - - Bitcoin version - - - - - Usage: - - - - - Send command to -server or bitcoind - - - - - List commands - - - - Get help for a command + Bitcoin version - Options: + Usage: - Specify configuration file (default: bitcoin.conf) + Send command to -server or bitcoind - Specify pid file (default: bitcoind.pid) + List commands - Generate coins + Get help for a command - Don't generate coins + Options: - Start minimized + Specify configuration file (default: bitcoin.conf) - Specify data directory + Specify pid file (default: bitcoind.pid) - Specify connection timeout (in milliseconds) + Generate coins - Connect through socks4 proxy + Don't generate coins - Allow DNS lookups for addnode and connect + Start minimized - Listen for connections on <port> (default: 8333 or testnet: 18333) + Show splash screen on startup (default: 1) - Maintain at most <n> connections to peers (default: 125) + Specify data directory - Add a node to connect to + Set database cache size in megabytes (default: 25) - Connect only to the specified node + Set database disk log size in megabytes (default: 100) - Don't accept connections from outside + Specify connection timeout (in milliseconds) - Don't bootstrap list of peers using DNS + Connect through socks4 proxy - Threshold for disconnecting misbehaving peers (default: 100) + Allow DNS lookups for addnode and connect - Number of seconds to keep misbehaving peers from reconnecting (default: 86400) + Listen for connections on <port> (default: 8333 or testnet: 18333) + + + + + Maintain at most <n> connections to peers (default: 125) - Maximum per-connection receive buffer, <n>*1000 bytes (default: 10000) + Connect only to the specified node - - Maximum per-connection send buffer, <n>*1000 bytes (default: 10000) + + Threshold for disconnecting misbehaving peers (default: 100) - - Don't attempt to use UPnP to map the listening port + + Number of seconds to keep misbehaving peers from reconnecting (default: 86400) - - Attempt to use UPnP to map the listening port + + Maximum per-connection receive buffer, <n>*1000 bytes (default: 10000) - - Fee per kB to add to transactions you send + + Maximum per-connection send buffer, <n>*1000 bytes (default: 10000) - + Accept command line and JSON-RPC commands - + Run in the background as a daemon and accept commands - + Use the test network - + Output extra debugging information - + Prepend debug output with timestamp - + Send trace/debug info to console instead of debug.log file - + Send trace/debug info to debugger - + Username for JSON-RPC connections - + Password for JSON-RPC connections - + Listen for JSON-RPC connections on <port> (default: 8332) - + Allow JSON-RPC connections from specified IP address - + 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) + + + + + Upgrade wallet to latest format + + + + Set key pool size to <n> (default: 100) - + Rescan the block chain for missing wallet transactions - + + How many blocks to check at startup (default: 2500, 0 = all) + + + + + How thorough the block verification is (0-6, default: 1) + + + + SSL options: (see the Bitcoin Wiki for SSL setup instructions) - + Use OpenSSL (https) for JSON-RPC connections - + Server certificate file (default: server.cert) - + Server private key (default: server.pem) - + Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH) - + This help message - + + Usage + + + + Cannot obtain a lock on data directory %s. Bitcoin is probably already running. - + + Bitcoin + + + + Loading addresses... - + Error loading addr.dat - + Error loading blkindex.dat - + Error loading wallet.dat: Wallet corrupted - + Error loading wallet.dat: Wallet requires newer version of Bitcoin - + Wallet needed to be rewritten: restart Bitcoin to complete - + Error loading wallet.dat - + + Error: Wallet locked, unable to create transaction + + + + + Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds + + + + + Error: Transaction creation failed + + + + + Sending... + + + + + Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here. + + + + + Invalid amount + + + + + Insufficient funds + + + + Loading block index... - + + Add a node to connect to and attempt to keep the connection open + + + + + Find peers using internet relay chat (default: 0) + + + + + Accept connections from outside (default: 1) + + + + + Set language, for example "de_DE" (default: system locale) + + + + + Find peers using DNS lookup (default: 1) + + + + + Use Universal Plug and Play to map the listening port (default: 1) + + + + + Use Universal Plug and Play to map the listening port (default: 0) + + + + + Fee per KB to add to transactions you send + + + + Loading wallet... - + + Cannot downgrade wallet + + + + + Cannot initialize keypool + + + + + Cannot write default address + + + + Rescanning... - + Done loading - + Invalid -proxy address - + Invalid amount for -paytxfee=<amount> - + Warning: -paytxfee is set very high. This is the transaction fee you will pay if you send a transaction. - + Error: CreateThread(StartNode) failed - + Warning: Disk space is low - + Unable to bind to port %d on this computer. Bitcoin is probably already running. - - Warning: Please check that your computer's date and time are correct. If your clock is wrong Bitcoin will not work properly. + + To use the %s option - - beta + + %s, you must set a rpcpassword in the configuration file: + %s +It is recommended you use the following random password: +rpcuser=bitcoinrpc +rpcpassword=%s +(you do not need to remember this password) +If the file does not exist, create it with owner-readable-only file permissions. + + + + + + Error + + + + + An error occured while setting up the RPC port %i for listening: %s + + + + + You must set rpcpassword=<password> in the configuration file: +%s +If the file does not exist, create it with owner-readable-only file permissions. + + + + + Warning: Please check that your computer's date and time are correct. If your clock is wrong Bitcoin will not work properly. diff --git a/src/qt/qrcodedialog.cpp b/src/qt/qrcodedialog.cpp index 9965f14..2a428fb 100644 --- a/src/qt/qrcodedialog.cpp +++ b/src/qt/qrcodedialog.cpp @@ -41,6 +41,11 @@ void QRCodeDialog::genCode() ui->lblQRCode->setText(""); QRcode *code = QRcode_encodeString(uri.toUtf8().constData(), 0, QR_ECLEVEL_L, QR_MODE_8, 1); + if (!code) + { + ui->lblQRCode->setText(tr("Error encoding URI into QR Code.")); + return; + } myImage = QImage(code->width + 8, code->width + 8, QImage::Format_RGB32); myImage.fill(0xffffff); unsigned char *p = code->data; diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 592ae6f..b4029aa 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -154,6 +154,8 @@ void SendCoinsDialog::on_sendButton_clicked() tr("Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."), QMessageBox::Ok, QMessageBox::Ok); break; + case WalletModel::Aborted: // User aborted, nothing to do + break; case WalletModel::OK: accept(); break; diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index aa11df9..41c9db1 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -45,8 +45,9 @@ struct TxLessThan }; // Private implementation -struct TransactionTablePriv +class TransactionTablePriv { +public: TransactionTablePriv(CWallet *wallet, TransactionTableModel *parent): wallet(wallet), parent(parent) diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index c446817..6c47f61 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -35,8 +35,7 @@ public: DuplicateAddress, TransactionCreationFailed, // Error returned when wallet is still locked TransactionCommitFailed, - Aborted, - MiscError + Aborted }; enum EncryptionStatus diff --git a/src/script.cpp b/src/script.cpp index b6f1202..21f101e 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1443,7 +1443,6 @@ bool ExtractAddresses(const CScript& scriptPubKey, txnouttype& typeRet, vector + +// Work around clang compilation problem in Boost 1.46: +// /usr/include/boost/program_options/detail/config_file.hpp:163:17: error: call to function 'to_internal' that is neither visible in the template definition nor found by argument-dependent lookup +// See also: http://stackoverflow.com/questions/10020179/compilation-fail-in-boost-librairies-program-options +// http://clang.debian.net/status.php?version=3.0&key=CANNOT_FIND_FUNCTION +namespace boost { + namespace program_options { + std::string to_internal(const std::string&); + } +} + #include #include #include @@ -625,7 +636,7 @@ vector DecodeBase64(const char* p, bool* pfInvalid) while (1) { - int dec = decode64_table[*p]; + int dec = decode64_table[(unsigned char)*p]; if (dec == -1) break; p++; switch (mode) @@ -665,12 +676,12 @@ vector DecodeBase64(const char* p, bool* pfInvalid) break; case 2: // 4n+2 base64 characters processed: require '==' - if (left || p[0] != '=' || p[1] != '=' || decode64_table[p[2]] != -1) + if (left || p[0] != '=' || p[1] != '=' || decode64_table[(unsigned char)p[2]] != -1) *pfInvalid = true; break; case 3: // 4n+3 base64 characters processed: require '=' - if (left || p[0] != '=' || decode64_table[p[1]] != -1) + if (left || p[0] != '=' || decode64_table[(unsigned char)p[1]] != -1) *pfInvalid = true; break; } diff --git a/src/wallet.cpp b/src/wallet.cpp index 97ed6aa..ff10e0c 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -648,8 +648,10 @@ void CWalletTx::AddSupportingTransactions(CTxDB& txdb) vtxPrev.push_back(tx); if (nDepth < COPY_DEPTH) + { BOOST_FOREACH(const CTxIn& txin, tx.vin) vWorkQueue.push_back(txin.prevout.hash); + } } } } diff --git a/src/wallet.h b/src/wallet.h index f864370..869e888 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -553,8 +553,10 @@ public: return false; if (mapPrev.empty()) + { BOOST_FOREACH(const CMerkleTx& tx, vtxPrev) mapPrev[tx.GetHash()] = &tx; + } BOOST_FOREACH(const CTxIn& txin, ptx->vin) {