From 9b9acc27d2ea91223177bc2509568721334af178 Mon Sep 17 00:00:00 2001 From: Diego Viola Date: Tue, 22 Sep 2015 04:25:26 -0300 Subject: Fix spelling of Qt --- src/qt/guiutil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 4a1f728e18..0f30057ef5 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -391,7 +391,7 @@ void SubstituteFonts(const QString& language) { #if defined(Q_OS_MAC) // Background: -// OSX's default font changed in 10.9 and QT is unable to find it with its +// OSX's default font changed in 10.9 and Qt is unable to find it with its // usual fallback methods when building against the 10.7 sdk or lower. // The 10.8 SDK added a function to let it find the correct fallback font. // If this fallback is not properly loaded, some characters may fail to -- cgit v1.2.3 From 01878c9c3f42961b8fb1356105b7b90abbce1c9d Mon Sep 17 00:00:00 2001 From: Alex Morcos Date: Thu, 17 Sep 2015 17:43:34 -0400 Subject: Fix locking in GetTransaction. GetTransaction needs to lock cs_main until ReadBlockFromDisk completes, the data inside CBlockIndex's can change since pruning. This lock was held by all calls to GetTransaction except rest_tx. --- src/main.cpp | 68 +++++++++++++++++++++++++++++------------------------------- 1 file changed, 33 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index f6deaa29b6..77d9227f5c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1092,47 +1092,45 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock, bool fAllowSlow) { CBlockIndex *pindexSlow = NULL; + + LOCK(cs_main); + + if (mempool.lookup(hash, txOut)) { - LOCK(cs_main); - { - if (mempool.lookup(hash, txOut)) - { - return true; - } - } + return true; + } - if (fTxIndex) { - CDiskTxPos postx; - if (pblocktree->ReadTxIndex(hash, postx)) { - CAutoFile file(OpenBlockFile(postx, true), SER_DISK, CLIENT_VERSION); - if (file.IsNull()) - return error("%s: OpenBlockFile failed", __func__); - CBlockHeader header; - try { - file >> header; - fseek(file.Get(), postx.nTxOffset, SEEK_CUR); - file >> txOut; - } catch (const std::exception& e) { - return error("%s: Deserialize or I/O error - %s", __func__, e.what()); - } - hashBlock = header.GetHash(); - if (txOut.GetHash() != hash) - return error("%s: txid mismatch", __func__); - return true; + if (fTxIndex) { + CDiskTxPos postx; + if (pblocktree->ReadTxIndex(hash, postx)) { + CAutoFile file(OpenBlockFile(postx, true), SER_DISK, CLIENT_VERSION); + if (file.IsNull()) + return error("%s: OpenBlockFile failed", __func__); + CBlockHeader header; + try { + file >> header; + fseek(file.Get(), postx.nTxOffset, SEEK_CUR); + file >> txOut; + } catch (const std::exception& e) { + return error("%s: Deserialize or I/O error - %s", __func__, e.what()); } + hashBlock = header.GetHash(); + if (txOut.GetHash() != hash) + return error("%s: txid mismatch", __func__); + return true; } + } - if (fAllowSlow) { // use coin database to locate block that contains transaction, and scan it - int nHeight = -1; - { - CCoinsViewCache &view = *pcoinsTip; - const CCoins* coins = view.AccessCoins(hash); - if (coins) - nHeight = coins->nHeight; - } - if (nHeight > 0) - pindexSlow = chainActive[nHeight]; + if (fAllowSlow) { // use coin database to locate block that contains transaction, and scan it + int nHeight = -1; + { + CCoinsViewCache &view = *pcoinsTip; + const CCoins* coins = view.AccessCoins(hash); + if (coins) + nHeight = coins->nHeight; } + if (nHeight > 0) + pindexSlow = chainActive[nHeight]; } if (pindexSlow) { -- cgit v1.2.3 From b3eaa301ff375e8568fa86642c0aac064f0946da Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 7 Sep 2015 11:00:59 +0200 Subject: [Qt] Raise debug window when requested * Raise the debug window when hidden behind other windows * Switch to the debug window when on another virtual desktop * Show the debug window when minimized This change is a conceptual copy of 5ffaaba and 382e9e2 --- src/qt/bitcoingui.cpp | 17 ++++++++++++----- src/qt/bitcoingui.h | 2 ++ 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 396435f12b..fa5083e004 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -212,11 +212,6 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) : statusBar()->addWidget(progressBar); statusBar()->addPermanentWidget(frameBlocks); - connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show())); - - // prevents an open debug window from becoming stuck/unusable on client shutdown - connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide())); - // Install event filter to be able to catch status tip events (QEvent::StatusTip) this->installEventFilter(this); @@ -349,6 +344,10 @@ void BitcoinGUI::createActions() connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked())); connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden())); connect(showHelpMessageAction, SIGNAL(triggered()), this, SLOT(showHelpMessageClicked())); + connect(openRPCConsoleAction, SIGNAL(triggered()), this, SLOT(showDebugWindow())); + // prevents an open debug window from becoming stuck/unusable on client shutdown + connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide())); + #ifdef ENABLE_WALLET if(walletFrame) { @@ -587,6 +586,14 @@ void BitcoinGUI::aboutClicked() dlg.exec(); } +void BitcoinGUI::showDebugWindow() +{ + rpcConsole->showNormal(); + rpcConsole->show(); + rpcConsole->raise(); + rpcConsole->activateWindow(); +} + void BitcoinGUI::showHelpMessageClicked() { HelpMessageDialog *help = new HelpMessageDialog(this, false); diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 4e50b1712a..b4647ae44c 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -191,6 +191,8 @@ private Q_SLOTS: void optionsClicked(); /** Show about dialog */ void aboutClicked(); + /** Show debug window */ + void showDebugWindow(); /** Show help message dialog */ void showHelpMessageClicked(); #ifndef Q_OS_MAC -- cgit v1.2.3 From a33cd5ba86c722cf523cf88f78604e2ac91331c2 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 4 Sep 2015 11:05:17 +0200 Subject: [trivial] Fix rpc message "help generate" --- src/rpcmining.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 528d5406f4..98133b0f5c 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -121,6 +121,7 @@ Value generate(const Array& params, bool fHelp) "generate numblocks\n" "\nMine blocks immediately (before the RPC call returns)\n" "\nNote: this function can only be used on the regtest network\n" + "\nArguments:\n" "1. numblocks (numeric) How many blocks are generated immediately.\n" "\nResult\n" "[ blockhashes ] (array) hashes of blocks generated\n" -- cgit v1.2.3 From 87a797a0166a03b716a2a6fa82f789655ef79a8c Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 28 Sep 2015 10:36:33 +0200 Subject: build: Remove dependency of bitcoin-cli on secp256k1 bitcoin-cli (in contrast to bitcoin-tx, which does signing ops) shouldn't need secp256k1, and indeed it doesn't. --- src/Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 8de216c176..2461f825f5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -343,8 +343,7 @@ endif bitcoin_cli_LDADD = \ $(LIBBITCOIN_CLI) \ - $(LIBBITCOIN_UTIL) \ - $(LIBSECP256K1) + $(LIBBITCOIN_UTIL) bitcoin_cli_LDADD += $(BOOST_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) # -- cgit v1.2.3 From 33d6825c6f91e99de65555d5f869134cfa54d967 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 9 Apr 2015 11:50:18 +0000 Subject: Bugfix: Allow mining on top of old tip blocks for testnet (fixes testnet-in-a-box use case) --- src/chainparams.cpp | 3 +++ src/chainparams.h | 2 ++ src/main.cpp | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 5f400b265c..c715393973 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -51,6 +51,7 @@ public: vAlertPubKey = ParseHex("04fc9702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284"); nDefaultPort = 8333; nMinerThreads = 0; + nMaxTipAge = 24 * 60 * 60; nPruneAfterHeight = 100000; /** @@ -147,6 +148,7 @@ public: vAlertPubKey = ParseHex("04302390343f91cc401d56d68b123028bf52e5fca1939df127f63c6467cdf9c8e2c14b61104cf817d0b780da337893ecc4aaff1309e536162dabbdb45200ca2b0a"); nDefaultPort = 18333; nMinerThreads = 0; + nMaxTipAge = 0x7fffffff; nPruneAfterHeight = 1000; //! Modify the testnet genesis block so the timestamp is valid for a later start. @@ -206,6 +208,7 @@ public: pchMessageStart[2] = 0xb5; pchMessageStart[3] = 0xda; nMinerThreads = 1; + nMaxTipAge = 24 * 60 * 60; genesis.nTime = 1296688602; genesis.nBits = 0x207fffff; genesis.nNonce = 2; diff --git a/src/chainparams.h b/src/chainparams.h index 8044b553e1..f61e3db132 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -60,6 +60,7 @@ public: bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; } /** Policy: Filter transactions that do not match well-defined patterns */ bool RequireStandard() const { return fRequireStandard; } + int64_t MaxTipAge() const { return nMaxTipAge; } int64_t PruneAfterHeight() const { return nPruneAfterHeight; } /** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */ bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; } @@ -80,6 +81,7 @@ protected: std::vector vAlertPubKey; int nDefaultPort; int nMinerThreads; + long nMaxTipAge; uint64_t nPruneAfterHeight; std::vector vSeeds; std::vector base58Prefixes[MAX_BASE58_TYPES]; diff --git a/src/main.cpp b/src/main.cpp index 77d9227f5c..29a84054ac 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1239,7 +1239,7 @@ bool IsInitialBlockDownload() if (lockIBDState) return false; bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 || - pindexBestHeader->GetBlockTime() < GetTime() - 24 * 60 * 60); + pindexBestHeader->GetBlockTime() < GetTime() - chainParams.MaxTipAge()); if (!state) lockIBDState = true; return state; -- cgit v1.2.3 From e42bf16ae03edf651916159f99551cf2779b9927 Mon Sep 17 00:00:00 2001 From: Eric Lombrozo Date: Sat, 10 Oct 2015 06:46:35 -0400 Subject: Clarification of unit test build instructions. --- src/test/README.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/test/README.md b/src/test/README.md index 7efce6f052..eeaceb60c6 100644 --- a/src/test/README.md +++ b/src/test/README.md @@ -16,6 +16,8 @@ their tests in a test suite called "_tests". For an examples of this pattern, examine uint160_tests.cpp and uint256_tests.cpp. +Add the source files to /src/Makefile.test.include to add them to the build. + For further reading, I found the following website to be helpful in explaining how the boost unit test framework works: [http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/](http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/). \ No newline at end of file -- cgit v1.2.3 From af6edac0bd637c07a9eb2cbb0dd1498b3593f801 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Sun, 18 Oct 2015 21:02:36 +1100 Subject: *: alias -h for --help --- src/bitcoin-cli.cpp | 2 +- src/bitcoin-tx.cpp | 2 +- src/bitcoind.cpp | 2 +- src/qt/bitcoin.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 1269d7a119..386c351492 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -62,7 +62,7 @@ static bool AppInitRPC(int argc, char* argv[]) // Parameters // ParseParameters(argc, argv); - if (argc<2 || mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version")) { + if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) { std::string strUsage = _("Bitcoin Core RPC client version") + " " + FormatFullVersion() + "\n"; if (!mapArgs.count("-version")) { strUsage += "\n" + _("Usage:") + "\n" + diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 40b4a38e41..319be2991e 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -41,7 +41,7 @@ static bool AppInitRawTx(int argc, char* argv[]) fCreateBlank = GetBoolArg("-create", false); - if (argc<2 || mapArgs.count("-?") || mapArgs.count("-help")) + if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help")) { // First part of help message is specific to this utility std::string strUsage = _("Bitcoin Core bitcoin-tx utility version") + " " + FormatFullVersion() + "\n\n" + diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index cce687ac98..6e2758a9d2 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -67,7 +67,7 @@ bool AppInit(int argc, char* argv[]) ParseParameters(argc, argv); // Process help and version before taking care about datadir - if (mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version")) + if (mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) { std::string strUsage = _("Bitcoin Core Daemon") + " " + _("version") + " " + FormatFullVersion() + "\n"; diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 8a78533420..94121686c3 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -548,7 +548,7 @@ int main(int argc, char *argv[]) // Show help message immediately after parsing command-line options (for "-lang") and setting locale, // but before showing splash screen. - if (mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version")) + if (mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) { HelpMessageDialog help(NULL, mapArgs.count("-version")); help.showOrPrint(); -- cgit v1.2.3