From 77088082ea3fc6399e463c46ecbd43eafe6726ba Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 28 Jun 2017 09:13:42 +0200 Subject: [PATCH 01/28] Merge #10684: Remove no longer used mempool.exists(outpoint) 22378ad Remove no longer used mempool.exists(outpoint) (Alex Morcos) Tree-SHA512: e98ffdf9039a1bdd84a388dc2da43221b8850bab413dffbd18c20fb06c791ff364f824d1b3b7c0a696987ae126e52b4ee200bb63c5c46e9782c1973c6d888d32 --- src/txmempool.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/txmempool.h b/src/txmempool.h index 64f032534eaa..775c987a83af 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -657,13 +657,6 @@ class CTxMemPool return (mapTx.count(hash) != 0); } - bool exists(const COutPoint& outpoint) const - { - LOCK(cs); - auto it = mapTx.find(outpoint.hash); - return (it != mapTx.end() && outpoint.n < it->GetTx().vout.size()); - } - CTransactionRef get(const uint256& hash) const; TxMempoolInfo info(const uint256& hash) const; std::vector infoAll() const; From 9bcadebf77a07366efbd571af12974c0a4b046bd Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 28 Jun 2017 14:33:44 +0200 Subject: [PATCH 02/28] Merge #10631: Use the override specifier (C++11) where we expect to be overriding the virtual function of a base class aa95947 Use the override specifier (C++11) where we expect to be overriding the virtual function of a base class (practicalswift) Tree-SHA512: 3835e9b4ceaa4b2db485a25dfa3e5fe50c2e3ecb22ca9d5331aed7728aa496d4378fb84c0a1a3c47b0adecc10a00bca99cc239cbaf94cf2ce5b4cda497db6023 --- src/support/lockedpool.cpp | 12 ++++++------ src/test/allocator_tests.cpp | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/support/lockedpool.cpp b/src/support/lockedpool.cpp index c5a49b68f194..ef477cf4e43e 100644 --- a/src/support/lockedpool.cpp +++ b/src/support/lockedpool.cpp @@ -148,9 +148,9 @@ class Win32LockedPageAllocator: public LockedPageAllocator { public: Win32LockedPageAllocator(); - void* AllocateLocked(size_t len, bool *lockingSuccess); - void FreeLocked(void* addr, size_t len); - size_t GetLimit(); + void* AllocateLocked(size_t len, bool *lockingSuccess) override; + void FreeLocked(void* addr, size_t len) override; + size_t GetLimit() override; private: size_t page_size; }; @@ -200,9 +200,9 @@ class PosixLockedPageAllocator: public LockedPageAllocator { public: PosixLockedPageAllocator(); - void* AllocateLocked(size_t len, bool *lockingSuccess); - void FreeLocked(void* addr, size_t len); - size_t GetLimit(); + void* AllocateLocked(size_t len, bool *lockingSuccess) override; + void FreeLocked(void* addr, size_t len) override; + size_t GetLimit() override; private: size_t page_size; }; diff --git a/src/test/allocator_tests.cpp b/src/test/allocator_tests.cpp index 1c668590f003..72db4b8d2b68 100644 --- a/src/test/allocator_tests.cpp +++ b/src/test/allocator_tests.cpp @@ -131,7 +131,7 @@ class TestLockedPageAllocator: public LockedPageAllocator { public: TestLockedPageAllocator(int count_in, int lockedcount_in): count(count_in), lockedcount(lockedcount_in) {} - void* AllocateLocked(size_t len, bool *lockingSuccess) + void* AllocateLocked(size_t len, bool *lockingSuccess) override { *lockingSuccess = false; if (count > 0) { @@ -146,10 +146,10 @@ class TestLockedPageAllocator: public LockedPageAllocator } return 0; } - void FreeLocked(void* addr, size_t len) + void FreeLocked(void* addr, size_t len) override { } - size_t GetLimit() + size_t GetLimit() override { return std::numeric_limits::max(); } From 0a215695a80f1cbceddd95ecfdf7dfb2c1f72ab6 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Wed, 28 Jun 2017 11:15:45 -0700 Subject: [PATCH 03/28] Merge #10685: Clarify CCoinsViewMemPool documentation. 381b8fc36 Clarify CCoinsViewMemPool documentation. (Matt Corallo) Tree-SHA512: 0d1520595a03ea4038b4119871d79dfc28a50f42ac7667b30a583805d4fe4b0480a6912b9b4f7660c7223778ef85f2f9d1870551383a35c5e8c88cd2935f59d3 --- src/rpc/blockchain.cpp | 2 +- src/txmempool.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 73ce295ea418..71f5d00af0d2 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1229,7 +1229,7 @@ UniValue gettxout(const JSONRPCRequest& request) if (fMempool) { LOCK(mempool.cs); CCoinsViewMemPool view(pcoinsTip, mempool); - if (!view.GetCoin(out, coin) || mempool.isSpent(out)) { // TODO: filtering spent coins should be done by the CCoinsViewMemPool + if (!view.GetCoin(out, coin) || mempool.isSpent(out)) { return NullUniValue; } } else { diff --git a/src/txmempool.h b/src/txmempool.h index 775c987a83af..6b1e1f117dcf 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -710,6 +710,13 @@ class CTxMemPool /** * CCoinsView that brings transactions from a memorypool into view. * It does not check for spendings by memory pool transactions. + * Instead, it provides access to all Coins which are either unspent in the + * base CCoinsView, or are outputs from any mempool transaction! + * This allows transaction replacement to work as expected, as you want to + * have all inputs "available" to check signatures, and any cycles in the + * dependency graph are checked directly in AcceptToMemoryPool. + * It also allows you to sign a double-spend directly in signrawtransaction, + * as long as the conflicting transaction is not yet confirmed. */ class CCoinsViewMemPool : public CCoinsViewBacked { From 184847c2edb2bb97f2b7977119c315188498e302 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 29 Jun 2017 14:44:07 +0200 Subject: [PATCH 04/28] Merge #10673: [qt] Avoid potential null pointer dereference in TransactionView::exportClicked() fd9599b [qt] Avoid potential null pointer dereference in TransactionView::exportClicked() (practicalswift) Tree-SHA512: 33cbb65bd86aceb58918eb0a19e1727599a22285e7c89d4e7d3b2639c879dc8939708fd506006c6c092f624050d1131f997cc37f837cb980aa440f8abe5a3c18 --- src/qt/transactionview.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 84e796b97dc4..cb37ca83439b 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -389,6 +389,10 @@ void TransactionView::changedAmount(const QString &amount) void TransactionView::exportClicked() { + if (!model || !model->getOptionsModel()) { + return; + } + // CSV is currently the only supported format QString filename = GUIUtil::getSaveFileName(this, tr("Export Transaction History"), QString(), From 9221e0d3c4bdaf41fbee343ff8fcca1caa86da84 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Mon, 3 Jul 2017 14:20:28 +0200 Subject: [PATCH 05/28] Merge #10728: fix typo in help text for removeprunedfunds ecb4fc382 fix typo in help text for removeprunedfunds (Akio Nakamura) Tree-SHA512: 2603851f1ac90bc0b90ced6355b0056e4cb658303cb2cd03ee0827ed0053157ebb87de48076f4d4f556991bfdbdb65d0a68a8dbd275c501cee4c9b5746a9562b --- src/wallet/rpcdump.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index fe72bfe93de9..6d0362c7ba74 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -363,7 +363,7 @@ UniValue removeprunedfunds(const JSONRPCRequest& request) "\nExamples:\n" + HelpExampleCli("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"") + "\nAs a JSON-RPC call\n" - + HelpExampleRpc("removprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"") + + HelpExampleRpc("removeprunedfunds", "\"a8d0c0184dde994a09ec054286f1ce581bebf46446a512166eae7628734ea0a5\"") ); LOCK2(cs_main, pwallet->cs_wallet); From a60f1e2b5c849b29d316576af9fad377ccc578bc Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 6 Jul 2017 18:11:49 +0200 Subject: [PATCH 06/28] Merge #10710: REST/RPC example update b8bb425 REST/RPC example update (Michael Rotarius) Tree-SHA512: 3a7003f5996f58d9881e7b7a9155f8b1c233faea2977cd02c481567b60fa47105433184da3d887ef3ec28775ad33719b779bff2753d64b775b29d8a7a6214fda --- doc/REST-interface.md | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/doc/REST-interface.md b/doc/REST-interface.md index d7d5c8d4c60c..3a3ada047a83 100644 --- a/doc/REST-interface.md +++ b/doc/REST-interface.md @@ -40,11 +40,13 @@ Only supports JSON as output format. * headers : (numeric) the current number of headers we have validated * bestblockhash : (string) the hash of the currently best block * difficulty : (numeric) the current difficulty +* mediantime : (numeric) the median time of the 11 blocks before the most recent block on the blockchain * verificationprogress : (numeric) estimate of verification progress [0..1] * chainwork : (string) total amount of work in active chain, in hexadecimal * pruned : (boolean) if the blocks are subject to pruning * pruneheight : (numeric) heighest block available * softforks : (array) status of softforks in progress +* bip9_softforks : (object) status of BIP9 softforks in progress #### Query UTXO set `GET /rest/getutxos//-/-/.../-.` @@ -57,25 +59,25 @@ Example: ``` $ curl localhost:18332/rest/getutxos/checkmempool/b2cdfd7b89def827ff8af7cd9bff7627ff72e5e8b0f71210f92ea7a4000c5d75-0.json 2>/dev/null | json_pp { - "chaintipHash" : "00000000fb01a7f3745a717f8caebee056c484e6e0bfe4a9591c235bb70506fb", "chainHeight" : 325347, + "chaintipHash" : "00000000fb01a7f3745a717f8caebee056c484e6e0bfe4a9591c235bb70506fb", + "bitmap": "1", "utxos" : [ { + "txvers" : 1 + "height" : 2147483647, + "value" : 8.8687, "scriptPubKey" : { - "addresses" : [ - "mi7as51dvLJsizWnTMurtRmrP8hG2m1XvD" - ], - "type" : "pubkeyhash", + "asm" : "OP_DUP OP_HASH160 1c7cebb529b86a04c683dfa87be49de35bcf589e OP_EQUALVERIFY OP_CHECKSIG", "hex" : "76a9141c7cebb529b86a04c683dfa87be49de35bcf589e88ac", "reqSigs" : 1, - "asm" : "OP_DUP OP_HASH160 1c7cebb529b86a04c683dfa87be49de35bcf589e OP_EQUALVERIFY OP_CHECKSIG" - }, - "value" : 8.8687, - "height" : 2147483647, - "txvers" : 1 + "type" : "pubkeyhash", + "addresses" : [ + "mi7as51dvLJsizWnTMurtRmrP8hG2m1XvD" + ] + } } - ], - "bitmap" : "1" + ] } ``` @@ -87,6 +89,8 @@ Only supports JSON as output format. * size : (numeric) the number of transactions in the TX mempool * bytes : (numeric) size of the TX mempool in bytes * usage : (numeric) total TX mempool memory usage +* maxmempool : (numeric) maximum memory usage for the mempool in bytes +* mempoolminfee : (numeric) minimum feerate (BTC per KB) for tx to be accepted `GET /rest/mempool/contents.json` From 6e2f77933f6abb96d9f1b2768ca3622de839b592 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 10 Jul 2017 17:50:01 +0200 Subject: [PATCH 07/28] Merge #10747: [rpc] fix verbose argument for getblock in bitcoin-cli 58e9864 [rpc] fix verbose argument for getblock in bitcoin-cli (John Newbery) Tree-SHA512: 7f176e1ddd9f3f7722ea0d268549629567ecf0c30bebf368824997566df0bfa01d31cf761abc9ca355e48c0bf0cb06d49d15a02b858999fcb7472dc7df2fbbf2 --- src/rpc/client.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index 0baf44eaab08..10ca11922859 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -101,6 +101,7 @@ static const CRPCConvertParam vRPCConvertParams[] = { "listunspent", 3, "include_unsafe" }, { "listunspent", 4, "query_options" }, { "getblock", 1, "verbosity" }, + { "getblock", 1, "verbose" }, { "getblockheader", 1, "verbose" }, { "getblockheaders", 1, "count" }, { "getblockheaders", 2, "verbose" }, From cf40b5409c3aacf8ff4736e56d9eccb3463bfb8f Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 11 Jul 2017 11:39:53 +0200 Subject: [PATCH 08/28] Merge #10676: document script-based return fields for validateaddress f2f1d0a document script-based return fields for validateaddress (Gregory Sanders) Tree-SHA512: 3310bb82b63ef20e46dd7ebcc9e15828cc7b6767ef19ddd869eeb5e4ee5b31ee307d21a44a9c81dbfe9d031bd48219e3ee1d330fc7b343d63d5365b68639c062 --- src/rpc/misc.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index ef886dbc1b7c..f2b9fc9d161d 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -335,6 +335,14 @@ UniValue validateaddress(const JSONRPCRequest& request) " \"ismine\" : true|false, (boolean) If the address is yours or not\n" " \"iswatchonly\" : true|false, (boolean) If the address is watchonly\n" " \"isscript\" : true|false, (boolean) If the key is a script\n" + " \"script\" : \"type\" (string, optional) The output script type. Possible types: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_keyhash, witness_v0_scripthash\n" + " \"hex\" : \"hex\", (string, optional) The redeemscript for the p2sh address\n" + " \"addresses\" (string, optional) Array of addresses associated with the known redeemscript\n" + " [\n" + " \"address\"\n" + " ,...\n" + " ]\n" + " \"sigsrequired\" : xxxxx (numeric, optional) Number of signatures required to spend multisig output\n" " \"pubkey\" : \"publickeyhex\", (string) The hex value of the raw public key\n" " \"iscompressed\" : true|false, (boolean) If the address is compressed\n" " \"account\" : \"account\" (string) DEPRECATED. The account associated with the address, \"\" is the default account\n" From f1c9b7a89307ff14752f95059f8166418db2c07b Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 11 Jul 2017 15:16:38 +0200 Subject: [PATCH 09/28] Merge #10190: [tests] mining functional tests (including regression test for submitblock) 11ba8e9 [tests] rename getblocktemplate_proposals.py to mining.py (John Newbery) b29dd41 [tests] add test for submit block (John Newbery) 9bf0d80 [tests] run successful test in getblocktemplate first (John Newbery) 82dc597 [tests] don't build blocks manually in getblocktemplate test (John Newbery) f82c709 [tests] clarify assertions in getblocktemplate test (John Newbery) 66c570a [tests] Don't build the coinbase manually in getblocktemplate test (John Newbery) 38b38cd [tests] getblocktemplate_proposals.py: add logging (John Newbery) 0a3a5ff [tests] Fix flake8 warnings in getblocktemplate tests (John Newbery) 32cffe6 [tests] Fix import order in getblocktemplate test (John Newbery) Tree-SHA512: a51a57314fa1c4c4b8a7896492ec6e677b6bed12387060def34a62e9dfbee7961f71bb5553fbd70028be61ae32eccf13fd255fa9651f908e9a5e64c28f43f00e --- test/functional/getblocktemplate_proposals.py | 157 ------------------ test/functional/mining.py | 124 ++++++++++++++ test/functional/test_runner.py | 2 +- 3 files changed, 125 insertions(+), 158 deletions(-) delete mode 100755 test/functional/getblocktemplate_proposals.py create mode 100755 test/functional/mining.py diff --git a/test/functional/getblocktemplate_proposals.py b/test/functional/getblocktemplate_proposals.py deleted file mode 100755 index fca99c7df571..000000000000 --- a/test/functional/getblocktemplate_proposals.py +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) 2014-2016 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. -"""Test block proposals with getblocktemplate.""" - -from test_framework.test_framework import BitcoinTestFramework -from test_framework.util import * - -from binascii import a2b_hex, b2a_hex -from hashlib import sha256 -from struct import pack - -def b2x(b): - return b2a_hex(b).decode('ascii') - -# NOTE: This does not work for signed numbers (set the high bit) or zero (use b'\0') -def encodeUNum(n): - s = bytearray(b'\1') - while n > 127: - s[0] += 1 - s.append(n % 256) - n //= 256 - s.append(n) - return bytes(s) - -def varlenEncode(n): - if n < 0xfd: - return pack(' 1: - n = [] - if len(cur) & 1: - cur.append(cur[-1]) - for i in range(0, len(cur), 2): - n.append(dblsha(cur[i] + cur[i+1])) - cur = n - return cur[0] - -def template_to_bytearray(tmpl, txlist): - blkver = pack(' Date: Tue, 11 Jul 2017 15:25:05 +0200 Subject: [PATCH 10/28] Merge #10651: Verify binaries from bitcoincore.org and bitcoin.org 6270d62 Verify binaries from bitcoincore.org and bitcoin.org (Matt Corallo) Tree-SHA512: 39e99ce9be3e7c99d17b296749c0af53c867039bc95fd5b03572593c812817decea75e7296bb66e89ba460518210d84114b7bdc22465df621340319b47bd4303 --- contrib/verifybinaries/verify.sh | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/contrib/verifybinaries/verify.sh b/contrib/verifybinaries/verify.sh index c2cc2b7013ad..409f517c9fb2 100755 --- a/contrib/verifybinaries/verify.sh +++ b/contrib/verifybinaries/verify.sh @@ -3,7 +3,8 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. -### This script attempts to download the signature file SHA256SUMS.asc from bitcoin.org +### This script attempts to download the signature file SHA256SUMS.asc from +### bitcoincore.org and bitcoin.org and compares them. ### It first checks if the signature passes, and then downloads the files specified in ### the file, and checks if the hashes of these files match those that are specified ### in the signature file. @@ -22,7 +23,9 @@ TMPFILE="hashes.tmp" SIGNATUREFILENAME="SHA256SUMS.asc" RCSUBDIR="test" -BASEDIR="https://bitcoin.org/bin/" +HOST1="https://bitcoincore.org" +HOST2="https://bitcoin.org" +BASEDIR="/bin/" VERSIONPREFIX="bitcoin-core-" RCVERSIONSTRING="rc" @@ -81,7 +84,7 @@ else fi #first we fetch the file containing the signature -WGETOUT=$(wget -N "$BASEDIR$SIGNATUREFILENAME" 2>&1) +WGETOUT=$(wget -N "$HOST1$BASEDIR$SIGNATUREFILENAME" 2>&1) #and then see if wget completed successfully if [ $? -ne 0 ]; then @@ -92,6 +95,22 @@ if [ $? -ne 0 ]; then exit 2 fi +WGETOUT=$(wget -N -O "$SIGNATUREFILENAME.2" "$HOST2$BASEDIR$SIGNATUREFILENAME" 2>&1) +if [ $? -ne 0 ]; then + echo "bitcoin.org failed to provide signature file, but bitcoincore.org did?" + echo "wget output:" + echo "$WGETOUT"|sed 's/^/\t/g' + clean_up $SIGNATUREFILENAME + exit 3 +fi + +SIGFILEDIFFS="$(diff $SIGNATUREFILENAME $SIGNATUREFILENAME.2)" +if [ "$SIGFILEDIFFS" != "" ]; then + echo "bitcoin.org and bitcoincore.org signature files were not equal?" + clean_up $SIGNATUREFILENAME $SIGNATUREFILENAME.2 + exit 4 +fi + #then we check it GPGOUT=$(gpg --yes --decrypt --output "$TMPFILE" "$SIGNATUREFILENAME" 2>&1) @@ -111,7 +130,7 @@ if [ $RET -ne 0 ]; then echo "gpg output:" echo "$GPGOUT"|sed 's/^/\t/g' - clean_up $SIGNATUREFILENAME $TMPFILE + clean_up $SIGNATUREFILENAME $SIGNATUREFILENAME.2 $TMPFILE exit "$RET" fi @@ -131,7 +150,7 @@ FILES=$(awk '{print $2}' "$TMPFILE") for file in $FILES do echo "Downloading $file" - wget --quiet -N "$BASEDIR$file" + wget --quiet -N "$HOST1$BASEDIR$file" done #check hashes @@ -149,7 +168,7 @@ fi if [ -n "$2" ]; then echo "Clean up the binaries" - clean_up $FILES $SIGNATUREFILENAME $TMPFILE + clean_up $FILES $SIGNATUREFILENAME $SIGNATUREFILENAME.2 $TMPFILE else echo "Keep the binaries in $WORKINGDIR" clean_up $TMPFILE From ec01825ba5ba92b6d841eec841d5de1acb60c17f Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 11 Jul 2017 15:39:55 +0200 Subject: [PATCH 11/28] Merge #10786: Add PR description to merge commit in github-merge.py 475c08c Add PR description to merge commit in github-merge.py (Pieter Wuille) Pull request description: There is often some context given in PR descriptions that is missing from commits, and it may be worthwhile to retain that information in our history in git. This PR adds that information to the merge commit when created through `github-merge.py`. We should also encourage people to provide as much information as possible in the PR commits themselves, but I believe that is an orthogonal issue. Individual commits don't need to have a description of the overall goal of a PR. Tree-SHA512: cbae46ec24ce911744e11a07e5d51895d3acc79659db306d8124304ef8e422bba99001ee2a741b08c92a5eb39d9c3f6b723622b20d6553ca5cfa0a8de866194c --- contrib/devtools/github-merge.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/devtools/github-merge.py b/contrib/devtools/github-merge.py index e9816f7d1916..c664cf81fa9f 100755 --- a/contrib/devtools/github-merge.py +++ b/contrib/devtools/github-merge.py @@ -175,6 +175,7 @@ def main(): if info is None: exit(1) title = info['title'].strip() + body = info['body'].strip() # precedence order for destination branch argument: # - command line argument # - githubmerge.branch setting @@ -229,6 +230,7 @@ def main(): firstline = 'Merge #%s' % (pull,) message = firstline + '\n\n' message += subprocess.check_output([GIT,'log','--no-merges','--topo-order','--pretty=format:%h %s (%an)',base_branch+'..'+head_branch]).decode('utf-8') + message += '\n\nPull request description:\n\n ' + body.replace('\n', '\n ') + '\n' try: subprocess.check_call([GIT,'merge','-q','--commit','--no-edit','--no-ff','-m',message.encode('utf-8'),head_branch]) except subprocess.CalledProcessError as e: From 28197ef74280c17e0ee04a9d7f6a55a9380d16b3 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Wed, 12 Jul 2017 15:14:22 -0700 Subject: [PATCH 12/28] Merge #10714: Avoid printing incorrect block indexing time due to uninitialized variable 959dd8781 Avoid printing incorrect block indexing time due to uninitialized variable (practicalswift) Tree-SHA512: a76e43c3ffa734ed5c7eadf363f345f268aa0e6ce775aba8f856fe3bbc82f240dc7c734c5ca3ac500a12eb41fae00623413e79f484d5acf809b6e400851d771d --- src/init.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/init.cpp b/src/init.cpp index 0012281d921e..35dd2cc58fbf 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1850,7 +1850,9 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler) LogPrintf("Shutdown requested. Exiting.\n"); return false; } - LogPrintf(" block index %15dms\n", GetTimeMillis() - nStart); + if (fLoaded) { + LogPrintf(" block index %15dms\n", GetTimeMillis() - nStart); + } fs::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME; CAutoFile est_filein(fsbridge::fopen(est_path, "rb"), SER_DISK, CLIENT_VERSION); From 526036ead80486320d771db02cb28251778efe69 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Wed, 12 Jul 2017 16:23:59 -0700 Subject: [PATCH 13/28] Merge #9804: Fixes subscript 0 (&var[0]) where should use (var.data()) instead. 30ac7688e Fix subscript[0] potential bugs in key.cpp (Jeremy Rubin) 4b1c0f2e2 Remove unnecessary branches in utilstrencodings string constructors. (Jeremy Rubin) e19db7b5a Fix subscript[0] in utilstrencodings.cpp (Jeremy Rubin) bc2e7fd98 Fix subscript[0] in streams.h (Jeremy Rubin) 4cac0d1e0 Fix subscript[0] in validation.cpp (Jeremy Rubin) ac658e55f Fix subscript[0] in torcontrol (Jeremy Rubin) b6856ebed Fix subscript[0] in netaddress.cpp (Jeremy Rubin) 361d95265 Fix subscript[0] in base58.cpp (Jeremy Rubin) 6896dbf16 Cleanup (safe, it was checked) subscript[0] in MurmurHash3 (and cleanup MurmurHash3 to be more clear). (Jeremy Rubin) 96f2119e6 Fix subscript[0] in compressor.cpp (Jeremy Rubin) 500710bd2 Fix 2 subscript[0] bugs in pubkey.cpp, and eliminate one extra size check (Jeremy Rubin) e0451e3e2 Fix subscript[0] bug in net.cpp if GetGroup returns a 0-sized vector (Jeremy Rubin) Tree-SHA512: 5b9103652cf8c615bd8f4f32b3573d291d6b67c39e0308ce00100bc6625f346e8e016b4c999f4f34f5c37ae059490a83c3b513deb21f838af785227d06e02362 --- src/base58.cpp | 12 +++++------ src/base58.h | 2 +- src/compressor.cpp | 8 ++++---- src/hash.cpp | 43 +++++++++++++++++++--------------------- src/key.cpp | 10 +++++----- src/net.cpp | 2 +- src/netaddress.cpp | 2 +- src/pubkey.cpp | 7 ++----- src/serialize.h | 12 +++++------ src/streams.h | 2 +- src/torcontrol.cpp | 2 +- src/utilstrencodings.cpp | 4 ++-- 12 files changed, 50 insertions(+), 56 deletions(-) diff --git a/src/base58.cpp b/src/base58.cpp index 0ae0ff2a4a33..47de1f98335c 100644 --- a/src/base58.cpp +++ b/src/base58.cpp @@ -110,7 +110,7 @@ std::string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend) std::string EncodeBase58(const std::vector& vch) { - return EncodeBase58(&vch[0], &vch[0] + vch.size()); + return EncodeBase58(vch.data(), vch.data() + vch.size()); } bool DecodeBase58(const std::string& str, std::vector& vchRet) @@ -160,7 +160,7 @@ void CBase58Data::SetData(const std::vector& vchVersionIn, const vchVersion = vchVersionIn; vchData.resize(nSize); if (!vchData.empty()) - memcpy(&vchData[0], pdata, nSize); + memcpy(vchData.data(), pdata, nSize); } void CBase58Data::SetData(const std::vector& vchVersionIn, const unsigned char* pbegin, const unsigned char* pend) @@ -180,8 +180,8 @@ bool CBase58Data::SetString(const char* psz, unsigned int nVersionBytes) vchVersion.assign(vchTemp.begin(), vchTemp.begin() + nVersionBytes); vchData.resize(vchTemp.size() - nVersionBytes); if (!vchData.empty()) - memcpy(&vchData[0], &vchTemp[nVersionBytes], vchData.size()); - memory_cleanse(&vchTemp[0], vchTemp.size()); + memcpy(vchData.data(), vchTemp.data() + nVersionBytes, vchData.size()); + memory_cleanse(vchTemp.data(), vchTemp.size()); return true; } @@ -262,7 +262,7 @@ CTxDestination CBitcoinAddress::Get() const if (!IsValid()) return CNoDestination(); uint160 id; - memcpy(&id, &vchData[0], 20); + memcpy(&id, vchData.data(), 20); if (vchVersion == Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS)) return CKeyID(id); else if (vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS)) @@ -293,7 +293,7 @@ bool CBitcoinAddress::GetKeyID(CKeyID& keyID) const if (!IsValid() || vchVersion != Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS)) return false; uint160 id; - memcpy(&id, &vchData[0], 20); + memcpy(&id, vchData.data(), 20); keyID = CKeyID(id); return true; } diff --git a/src/base58.h b/src/base58.h index afb986be2621..840ae7bad566 100644 --- a/src/base58.h +++ b/src/base58.h @@ -149,7 +149,7 @@ template class CBitcoinExtK K ret; if (vchData.size() == Size) { // If base58 encoded data does not hold an ext key, return a !IsValid() key - ret.Decode(&vchData[0]); + ret.Decode(vchData.data()); } return ret; } diff --git a/src/compressor.cpp b/src/compressor.cpp index 20c154fc1e58..f4c12f38d2d1 100644 --- a/src/compressor.cpp +++ b/src/compressor.cpp @@ -93,7 +93,7 @@ bool CScriptCompressor::Decompress(unsigned int nSize, const std::vector 0) - { - const uint32_t c1 = 0xcc9e2d51; - const uint32_t c2 = 0x1b873593; + const uint32_t c1 = 0xcc9e2d51; + const uint32_t c2 = 0x1b873593; - const int nblocks = vDataToHash.size() / 4; + const int nblocks = vDataToHash.size() / 4; - //---------- - // body - const uint8_t* blocks = &vDataToHash[0] + nblocks * 4; + //---------- + // body + const uint8_t* blocks = vDataToHash.data(); - for (int i = -nblocks; i; i++) { - uint32_t k1 = ReadLE32(blocks + i*4); + for (int i = 0; i < nblocks; ++i) { + uint32_t k1 = ReadLE32(blocks + i*4); - k1 *= c1; - k1 = ROTL32(k1, 15); - k1 *= c2; + k1 *= c1; + k1 = ROTL32(k1, 15); + k1 *= c2; - h1 ^= k1; - h1 = ROTL32(h1, 13); - h1 = h1 * 5 + 0xe6546b64; - } + h1 ^= k1; + h1 = ROTL32(h1, 13); + h1 = h1 * 5 + 0xe6546b64; + } - //---------- - // tail - const uint8_t* tail = (const uint8_t*)(&vDataToHash[0] + nblocks * 4); + //---------- + // tail + const uint8_t* tail = vDataToHash.data() + nblocks * 4; - uint32_t k1 = 0; + uint32_t k1 = 0; - switch (vDataToHash.size() & 3) { + switch (vDataToHash.size() & 3) { case 3: k1 ^= tail[2] << 16; case 2: @@ -57,7 +55,6 @@ unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector& vchSig, uint32_ secp256k1_ecdsa_signature sig; int ret = secp256k1_ecdsa_sign(secp256k1_context_sign, &sig, hash.begin(), begin(), secp256k1_nonce_function_rfc6979, test_case ? extra_entropy : NULL); assert(ret); - secp256k1_ecdsa_signature_serialize_der(secp256k1_context_sign, (unsigned char*)&vchSig[0], &nSigLen, &sig); + secp256k1_ecdsa_signature_serialize_der(secp256k1_context_sign, (unsigned char*)vchSig.data(), &nSigLen, &sig); vchSig.resize(nSigLen); return true; } @@ -202,7 +202,7 @@ bool CKey::SignCompact(const uint256 &hash, std::vector& vchSig) } bool CKey::Load(CPrivKey &privkey, CPubKey &vchPubKey, bool fSkipCheck=false) { - if (!ec_privkey_import_der(secp256k1_context_sign, (unsigned char*)begin(), &privkey[0], privkey.size())) + if (!ec_privkey_import_der(secp256k1_context_sign, (unsigned char*)begin(), privkey.data(), privkey.size())) return false; fCompressed = vchPubKey.IsCompressed(); fValid = true; @@ -245,8 +245,8 @@ void CExtKey::SetMaster(const unsigned char *seed, unsigned int nSeedLen) { static const unsigned char hashkey[] = {'B','i','t','c','o','i','n',' ','s','e','e','d'}; std::vector> vout(64); CHMAC_SHA512(hashkey, sizeof(hashkey)).Write(seed, nSeedLen).Finalize(vout.data()); - key.Set(&vout[0], &vout[32], true); - memcpy(chaincode.begin(), &vout[32], 32); + key.Set(vout.data(), vout.data() + 32, true); + memcpy(chaincode.begin(), vout.data() + 32, 32); nDepth = 0; nChild = 0; memset(vchFingerprint, 0, sizeof(vchFingerprint)); diff --git a/src/net.cpp b/src/net.cpp index 3b7cbed43063..27bbf58a9865 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -3365,5 +3365,5 @@ uint64_t CConnman::CalculateKeyedNetGroup(const CAddress& ad) const { std::vector vchNetGroup(ad.GetGroup()); - return GetDeterministicRandomizer(RANDOMIZER_ID_NETGROUP).Write(&vchNetGroup[0], vchNetGroup.size()).Finalize(); + return GetDeterministicRandomizer(RANDOMIZER_ID_NETGROUP).Write(vchNetGroup.data(), vchNetGroup.size()).Finalize(); } diff --git a/src/netaddress.cpp b/src/netaddress.cpp index 8252232f7b70..77ef7f381402 100644 --- a/src/netaddress.cpp +++ b/src/netaddress.cpp @@ -583,7 +583,7 @@ std::vector CService::GetKey() const { std::vector vKey; vKey.resize(18); - memcpy(&vKey[0], ip, 16); + memcpy(vKey.data(), ip, 16); vKey[16] = port / 0x100; vKey[17] = port & 0x0FF; return vKey; diff --git a/src/pubkey.cpp b/src/pubkey.cpp index f8f68af6f831..11b8afc192d7 100644 --- a/src/pubkey.cpp +++ b/src/pubkey.cpp @@ -172,10 +172,7 @@ bool CPubKey::Verify(const uint256 &hash, const std::vector& vchS if (!secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, &(*this)[0], size())) { return false; } - if (vchSig.size() == 0) { - return false; - } - if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, &vchSig[0], vchSig.size())) { + if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, vchSig.data(), vchSig.size())) { return false; } /* libsecp256k1's ECDSA verification requires lower-S signatures, which have @@ -274,7 +271,7 @@ bool CExtPubKey::Derive(CExtPubKey &out, unsigned int _nChild) const { /* static */ bool CPubKey::CheckLowS(const std::vector& vchSig) { secp256k1_ecdsa_signature sig; - if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, &vchSig[0], vchSig.size())) { + if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, vchSig.data(), vchSig.size())) { return false; } return (!secp256k1_ecdsa_signature_normalize(secp256k1_context_verify, NULL, &sig)); diff --git a/src/serialize.h b/src/serialize.h index 6afb0677d445..e02903c7a0de 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -630,7 +630,7 @@ class LimitedString } string.resize(size); if (size != 0) - s.read((char*)&string[0], size); + s.read((char*)string.data(), size); } template @@ -638,7 +638,7 @@ class LimitedString { WriteCompactSize(s, string.size()); if (!string.empty()) - s.write((char*)&string[0], string.size()); + s.write((char*)string.data(), string.size()); } }; @@ -778,7 +778,7 @@ void Serialize(Stream& os, const std::basic_string& str) { WriteCompactSize(os, str.size()); if (!str.empty()) - os.write((char*)&str[0], str.size() * sizeof(str[0])); + os.write((char*)str.data(), str.size() * sizeof(C)); } template @@ -787,7 +787,7 @@ void Unserialize(Stream& is, std::basic_string& str) unsigned int nSize = ReadCompactSize(is); str.resize(nSize); if (nSize != 0) - is.read((char*)&str[0], nSize * sizeof(str[0])); + is.read((char*)str.data(), nSize * sizeof(C)); } @@ -800,7 +800,7 @@ void Serialize_impl(Stream& os, const prevector& v, const unsigned char&) { WriteCompactSize(os, v.size()); if (!v.empty()) - os.write((char*)&v[0], v.size() * sizeof(T)); + os.write((char*)v.data(), v.size() * sizeof(T)); } template @@ -868,7 +868,7 @@ void Serialize_impl(Stream& os, const std::vector& v, const unsigned char& { WriteCompactSize(os, v.size()); if (!v.empty()) - os.write((char*)&v[0], v.size() * sizeof(T)); + os.write((char*)v.data(), v.size() * sizeof(T)); } template diff --git a/src/streams.h b/src/streams.h index 57fa9a879b3f..5611af103a7d 100644 --- a/src/streams.h +++ b/src/streams.h @@ -346,7 +346,7 @@ class CDataStream { // Special case: stream << stream concatenates like stream += stream if (!vch.empty()) - s.write((char*)&vch[0], vch.size() * sizeof(vch[0])); + s.write((char*)vch.data(), vch.size() * sizeof(value_type)); } template diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp index 0f6e11a2eab3..b7c07f17f492 100644 --- a/src/torcontrol.cpp +++ b/src/torcontrol.cpp @@ -663,7 +663,7 @@ void TorController::protocolinfo_cb(TorControlConnection& _conn, const TorContro // _conn.Command("AUTHENTICATE " + HexStr(status_cookie.second), boost::bind(&TorController::auth_cb, this, _1, _2)); cookie = std::vector(status_cookie.second.begin(), status_cookie.second.end()); clientNonce = std::vector(TOR_NONCE_SIZE, 0); - GetRandBytes(&clientNonce[0], TOR_NONCE_SIZE); + GetRandBytes(clientNonce.data(), TOR_NONCE_SIZE); _conn.Command("AUTHCHALLENGE SAFECOOKIE " + HexStr(clientNonce), boost::bind(&TorController::authchallenge_cb, this, _1, _2)); } else { if (status_cookie.first) { diff --git a/src/utilstrencodings.cpp b/src/utilstrencodings.cpp index 339f805b794f..682ae8de2555 100644 --- a/src/utilstrencodings.cpp +++ b/src/utilstrencodings.cpp @@ -228,7 +228,7 @@ std::vector DecodeBase64(const char* p, bool* pfInvalid) std::string DecodeBase64(const std::string& str) { std::vector vchRet = DecodeBase64(str.c_str()); - return (vchRet.size() == 0) ? std::string() : std::string((const char*)&vchRet[0], vchRet.size()); + return std::string((const char*)vchRet.data(), vchRet.size()); } std::string EncodeBase32(const unsigned char* pch, size_t len) @@ -415,7 +415,7 @@ std::vector DecodeBase32(const char* p, bool* pfInvalid) std::string DecodeBase32(const std::string& str) { std::vector vchRet = DecodeBase32(str.c_str()); - return (vchRet.size() == 0) ? std::string() : std::string((const char*)&vchRet[0], vchRet.size()); + return std::string((const char*)vchRet.data(), vchRet.size()); } static bool ParsePrechecks(const std::string& str) From 09854d66133d65d1f8f4664d61041ce6ed738897 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Wed, 12 Jul 2017 18:23:30 -0700 Subject: [PATCH 14/28] Merge #10780: Simplify "!foo || (foo && bar)" as "!foo || bar" 1e3a3200a Simplify "!foo || (foo && bar)" as "!foo || bar" (practicalswift) Tree-SHA512: d5ce6d7a9f3741e7abe8542b840268aa683e276aac7587041d32385a4c1273e20c236bec7590e27540dde72defb3f879d4695822bb7bfdb092cc20d9aefa64c1 --- src/validation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/validation.cpp b/src/validation.cpp index b3ccadc4b1a5..1e0b459fdbdd 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1314,7 +1314,7 @@ static void CheckForkWarningConditionsOnNewFork(CBlockIndex* pindexNewForkTip) // hash rate operating on the fork. // We define it this way because it allows us to only store the highest fork tip (+ base) which meets // the 7-block condition and from this always have the most-likely-to-cause-warning fork - if (pfork && (!pindexBestForkTip || (pindexBestForkTip && pindexNewForkTip->nHeight > pindexBestForkTip->nHeight)) && + if (pfork && (!pindexBestForkTip || pindexNewForkTip->nHeight > pindexBestForkTip->nHeight) && pindexNewForkTip->nChainWork - pfork->nChainWork > (GetBlockProof(*pfork) * 7) && chainActive.Height() - pindexNewForkTip->nHeight < 72) { From a0ff957d1813c8380ad8fe3d476680a14e17be06 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 14 Jul 2017 09:23:56 +0200 Subject: [PATCH 15/28] Merge #10806: build: verify that the assembler can handle crc32 functions d34d77a build: verify that the assembler can handle crc32 functions (Cory Fields) Pull request description: Also, enable crc32 even if -msse4.2 wasn't added by us, as long as it works. This allows custom flags (such as -march=native) to work as expected. Addresses #10670. Tree-SHA512: e1a41a87b078d270bc645814315b229ad9c16556a4d14fb66b27a65b28d0caf9bf324f8c1e221854992aa17f53466eece06faebbf74d59b3d4ff2e6db6c614a4 --- configure.ac | 27 +++++++++++++++++++++++++-- src/Makefile.leveldb.include | 2 +- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 2f7f8b6fb17d..c6446f1d7927 100644 --- a/configure.ac +++ b/configure.ac @@ -290,9 +290,32 @@ if test "x$CXXFLAGS_overridden" = "xno"; then # Check for optional instruction set support. Enabling these does _not_ imply that all code will # be compiled with them, rather that specific objects/libs may use them after checking for runtime # compatibility. - AX_CHECK_COMPILE_FLAG([-msse4.2],[[enable_sse42=yes; SSE42_CXXFLAGS="-msse4.2"]],,[[$CXXFLAG_WERROR]]) + AX_CHECK_COMPILE_FLAG([-msse4.2],[[SSE42_CXXFLAGS="-msse4.2"]],,[[$CXXFLAG_WERROR]]) fi + +TEMP_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $SSE42_CXXFLAGS" +AC_MSG_CHECKING(for assembler crc32 support) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include + #if defined(_MSC_VER) + #include + #elif defined(__GNUC__) && defined(__SSE4_2__) + #include + #endif + ]],[[ + uint64_t l = 0; + l = _mm_crc32_u8(l, 0); + l = _mm_crc32_u32(l, 0); + l = _mm_crc32_u64(l, 0); + return l; + ]])], + [ AC_MSG_RESULT(yes); enable_hwcrc32=yes], + [ AC_MSG_RESULT(no)] +) +CXXFLAGS="$TEMP_CXXFLAGS" + CPPFLAGS="$CPPFLAGS -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS" AC_ARG_WITH([utils], @@ -1188,7 +1211,7 @@ AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes]) AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes]) AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes]) AM_CONDITIONAL([HARDEN],[test x$use_hardening = xyes]) -AM_CONDITIONAL([ENABLE_SSE42],[test x$enable_sse42 = xyes]) +AM_CONDITIONAL([ENABLE_HWCRC32],[test x$enable_hwcrc32 = xyes]) AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version]) AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version]) diff --git a/src/Makefile.leveldb.include b/src/Makefile.leveldb.include index ac38141f43d7..833f3d2a10ca 100644 --- a/src/Makefile.leveldb.include +++ b/src/Makefile.leveldb.include @@ -142,7 +142,7 @@ leveldb_libmemenv_a_SOURCES += leveldb/helpers/memenv/memenv.h leveldb_libleveldb_sse42_a_CPPFLAGS = $(leveldb_libleveldb_a_CPPFLAGS) leveldb_libleveldb_sse42_a_CXXFLAGS = $(leveldb_libleveldb_a_CXXFLAGS) -if ENABLE_SSE42 +if ENABLE_HWCRC32 leveldb_libleveldb_sse42_a_CPPFLAGS += -DLEVELDB_PLATFORM_POSIX_SSE leveldb_libleveldb_sse42_a_CXXFLAGS += $(SSE42_CXXFLAGS) endif From 17177202a0632bc54ac86c15b8adf4520510d970 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Fri, 14 Jul 2017 11:54:09 -0700 Subject: [PATCH 16/28] Merge #10557: Make check to distinguish between orphan txs and old txs more efficient. 18bacec6c Make check to distinguish between orphan txs and old txs more efficient. (Alex Morcos) Tree-SHA512: b6b4bad89aa561975dce7b68b2fdad5623af5ebcb9c38fd6a72b5f6d0544ed441df4865591ac018f7ae0df9b5c60820cb4d9e55664f5667c9268458df70fd554 --- src/validation.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/validation.cpp b/src/validation.cpp index 1e0b459fdbdd..d90c622feb5b 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -734,24 +734,20 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool CCoinsViewMemPool viewMemPool(pcoinsTip, pool); view.SetBackend(viewMemPool); - // do we already have it? - for (size_t out = 0; out < tx.vout.size(); out++) { - COutPoint outpoint(hash, out); - bool had_coin_in_cache = pcoinsTip->HaveCoinInCache(outpoint); - if (view.HaveCoin(outpoint)) { - if (!had_coin_in_cache) { - coins_to_uncache.push_back(outpoint); - } - return state.Invalid(false, REJECT_DUPLICATE, "txn-already-known"); - } - } - // do all inputs exist? for (const CTxIn txin : tx.vin) { if (!pcoinsTip->HaveCoinInCache(txin.prevout)) { coins_to_uncache.push_back(txin.prevout); } if (!view.HaveCoin(txin.prevout)) { + // Are inputs missing because we already have the tx? + for (size_t out = 0; out < tx.vout.size(); out++) { + // Optimistically just do efficient check of cache for outputs + if (pcoinsTip->HaveCoinInCache(COutPoint(hash, out))) { + return state.Invalid(false, REJECT_DUPLICATE, "txn-already-known"); + } + } + // Otherwise assume this might be an orphan tx for which we just haven't seen parents yet if (pfMissingInputs) { *pfMissingInputs = true; } From b14bd204ce00d06fa9f5df3ae546c107bff50431 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Fri, 14 Jul 2017 14:33:10 -0700 Subject: [PATCH 17/28] Merge #10819: Fix uninitialized atomic variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 465279114 Fix uninitialized atomic variables (João Barbosa) Tree-SHA512: 5dd8924bc8743a094abdbc2464b835a0e7fd4948c102ea7c2251c6330bea5615c4459ba322a656fd6ac5f8d695b69d3709d225ddccef226cf8afc7de5e3d3019 --- src/netbase.cpp | 2 +- src/wallet/db.h | 4 ++-- src/wallet/walletdb.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/netbase.cpp b/src/netbase.cpp index a6d2bdc6bf9e..1dbf7100db23 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -563,7 +563,7 @@ static bool ConnectThroughProxy(const proxyType &proxy, const std::string& strDe // do socks negotiation if (proxy.randomize_credentials) { ProxyCredentials random_auth; - static std::atomic_int counter; + static std::atomic_int counter(0); random_auth.username = random_auth.password = strprintf("%i", counter++); if (!Socks5(strDest, (unsigned short)port, &random_auth, hSocket)) return false; diff --git a/src/wallet/db.h b/src/wallet/db.h index a5ac3bf93720..d1f4c633553c 100644 --- a/src/wallet/db.h +++ b/src/wallet/db.h @@ -95,13 +95,13 @@ class CWalletDBWrapper friend class CDB; public: /** Create dummy DB handle */ - CWalletDBWrapper() : nLastSeen(0), nLastFlushed(0), nLastWalletUpdate(0), env(nullptr) + CWalletDBWrapper() : nUpdateCounter(0), nLastSeen(0), nLastFlushed(0), nLastWalletUpdate(0), env(nullptr) { } /** Create DB handle to real database */ CWalletDBWrapper(CDBEnv *env_in, const std::string &strFile_in) : - nLastSeen(0), nLastFlushed(0), nLastWalletUpdate(0), env(env_in), strFile(strFile_in) + nUpdateCounter(0), nLastSeen(0), nLastFlushed(0), nLastWalletUpdate(0), env(env_in), strFile(strFile_in) { } diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index 49edb91d2fa9..face9a01491f 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -782,7 +782,7 @@ DBErrors CWalletDB::ZapWalletTx(std::vector& vWtx) void MaybeCompactWalletDB() { - static std::atomic fOneThread; + static std::atomic fOneThread(false); if (fOneThread.exchange(true)) { return; } From 29760e78bc5c54ef2d5a64bc91ac04b307a9d1b6 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Fri, 14 Jul 2017 17:55:56 -0700 Subject: [PATCH 18/28] Merge #10808: Avoid some new gcc warnings in 15 c73b8be24 Explicitly initialize prevector::_union to avoid new warning (Matt Corallo) 1016dacfa Fix signed/unsigned comparison warning introduced in c8e29d7ff0. (Matt Corallo) Tree-SHA512: d1574b0fdc9bfddc3517c382d34418b1d8ed80c81d2f6fd19378c064af8d7704fb84ef8b740ff97f7ec7609bd6de76348921fcc227e1ce97127947a0d22c7887 --- src/core_read.cpp | 2 +- src/prevector.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core_read.cpp b/src/core_read.cpp index f6bac8cde0cb..18ddd9433391 100644 --- a/src/core_read.cpp +++ b/src/core_read.cpp @@ -27,7 +27,7 @@ CScript ParseScript(const std::string& s) if (mapOpNames.empty()) { - for (int op = 0; op <= OP_NOP10; op++) + for (unsigned int op = 0; op <= OP_NOP10; op++) { // Allow OP_RESERVED to get into mapOpNames if (op < OP_NOP && op != OP_RESERVED) diff --git a/src/prevector.h b/src/prevector.h index 597838a175c1..c5f84f1b7a74 100644 --- a/src/prevector.h +++ b/src/prevector.h @@ -220,7 +220,7 @@ class prevector { } } - prevector() : _size(0) {} + prevector() : _size(0), _union{{}} {} explicit prevector(size_type n) : _size(0) { resize(n); From 38f52f881d8d8032dce4dadab3ed611e5e26b97c Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Fri, 14 Jul 2017 19:01:17 -0700 Subject: [PATCH 19/28] Merge #10816: Properly forbid -salvagewallet and -zapwallettxes for multi wallet. dd97a529a Properly forbid -salvagewallet and -zapwallettxes for multi wallet. (Alex Morcos) Tree-SHA512: dcde8f854ae957b4d3af4bcf1b811e0b6e9b93602764f86499e46a28d304cd4ee93ba058c03f6ca74ccb60e1310c83e53b698c64d93e5503115377655b80d44d --- src/wallet/wallet.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 7b659b92a0b5..58b8b69d0e5b 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -5131,20 +5131,24 @@ bool CWallet::ParameterInteraction() LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__); } - if (gArgs.GetBoolArg("-salvagewallet", false) && gArgs.SoftSetBoolArg("-rescan", true)) { + if (gArgs.GetBoolArg("-salvagewallet", false)) { if (is_multiwallet) { return InitError(strprintf("%s is only allowed with a single wallet file", "-salvagewallet")); } // Rewrite just private keys: rescan to find transactions - LogPrintf("%s: parameter interaction: -salvagewallet=1 -> setting -rescan=1\n", __func__); + if (gArgs.SoftSetBoolArg("-rescan", true)) { + LogPrintf("%s: parameter interaction: -salvagewallet=1 -> setting -rescan=1\n", __func__); + } } // -zapwallettx implies a rescan - if (gArgs.GetBoolArg("-zapwallettxes", false) && gArgs.SoftSetBoolArg("-rescan", true)) { + if (gArgs.GetBoolArg("-zapwallettxes", false)) { if (is_multiwallet) { return InitError(strprintf("%s is only allowed with a single wallet file", "-zapwallettxes")); } - LogPrintf("%s: parameter interaction: -zapwallettxes= -> setting -rescan=1\n", __func__); + if (gArgs.SoftSetBoolArg("-rescan", true)) { + LogPrintf("%s: parameter interaction: -zapwallettxes= -> setting -rescan=1\n", __func__); + } } if (is_multiwallet) { From 445e8d85c2aa2adfcace933f97e7e198a5a74a86 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sat, 15 Jul 2017 11:10:31 -0700 Subject: [PATCH 20/28] Merge #10807: getbalance example covers at least 6 confirms 228987d84 getbalance example covers at least 6 confirms (Gregory Sanders) Tree-SHA512: 328d60b007ee75d809f4d28a7d9e5537d3c1446bd30c4c2ae57c690b8e83f6287cbcd3d8c955e8ba07ab62e27f9d27497c55219ff14fd5af7759dec465673fa2 --- src/wallet/rpcwallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 2cbb0ce52ee9..00b78daf518b 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -767,9 +767,9 @@ UniValue getbalance(const JSONRPCRequest& request) "\nResult:\n" "amount (numeric) The total amount in " + CURRENCY_UNIT + " received for this account.\n" "\nExamples:\n" - "\nThe total amount in the wallet\n" + "\nThe total amount in the wallet with 1 or more confirmations\n" + HelpExampleCli("getbalance", "") + - "\nThe total amount in the wallet at least 5 blocks confirmed\n" + "\nThe total amount in the wallet at least 6 blocks confirmed\n" + HelpExampleCli("getbalance", "\"*\" 6") + "\nAs a json rpc call\n" + HelpExampleRpc("getbalance", "\"*\", 6") From 483786a725dbb779680acf79502f20558919b9c1 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sat, 15 Jul 2017 13:16:56 -0700 Subject: [PATCH 21/28] Merge #10812: [utils] Allow bitcoin-cli's -rpcconnect option to be used with square brackets 5c643241e [utils] allow square brackets for ipv6 addresses in bitcoin-cli (John Newbery) fe4fabaf1 [refactor] move SplitHostPort() into utilstrencodings (John Newbery) Pull request description: bitcoin-cli's `-rpcconnect` can accept ipv6 addresses (as long as the libevent version is new enough), but fails to parse ipv6 with square brackets. This PR makes `bitcoin-cli` parse ipv6 in square brackets correctly. `bitcoin-cli -rpcconnect=[::1] ` should now be equivalent to `bitcoin-cli -rpcconnect=::1 ` This is useful so the `bitcoin-cli` option can now be in the same format as the `bitcoind` option. Doesn't include tests. I have a branch that fully tests `bitcoin-cli`, but that's queued behind several intermediate PRs. - first commit moves `SplitHostPort()` from libbitcoin_common into libbitcoin_util - second commit adds proper ipv6 parsing to bitcoin-cli Tree-SHA512: 249d409f10360c989474283341f458cc97364a56a7d004ae6d5f13d8bffe3a51b5dc2484d42218848e2d42cd9c0b13a1b92e94ea19b209f7e91c875c208d8409 --- src/dash-cli.cpp | 11 +++++++++-- src/httpserver.cpp | 1 + src/netbase.cpp | 19 ------------------- src/netbase.h | 1 - src/test/netbase_tests.cpp | 1 + src/utilstrencodings.cpp | 19 +++++++++++++++++++ src/utilstrencodings.h | 1 + 7 files changed, 31 insertions(+), 22 deletions(-) diff --git a/src/dash-cli.cpp b/src/dash-cli.cpp index bd4cca441981..6f62ca46579b 100644 --- a/src/dash-cli.cpp +++ b/src/dash-cli.cpp @@ -11,6 +11,7 @@ #include "chainparamsbase.h" #include "clientversion.h" #include "fs.h" +#include "utilstrencodings.h" #include "rpc/client.h" #include "rpc/protocol.h" #include "stacktraces.h" @@ -204,8 +205,14 @@ static void http_error_cb(enum evhttp_request_error err, void *ctx) UniValue CallRPC(const std::string& strMethod, const UniValue& params) { - std::string host = gArgs.GetArg("-rpcconnect", DEFAULT_RPCCONNECT); - int port = gArgs.GetArg("-rpcport", BaseParams().RPCPort()); + std::string host; + // In preference order, we choose the following for the port: + // 1. -rpcport + // 2. port in -rpcconnect (ie following : in ipv4 or ]: in ipv6) + // 3. default port for chain + int port = BaseParams().RPCPort(); + SplitHostPort(gArgs.GetArg("-rpcconnect", DEFAULT_RPCCONNECT), port, host); + port = gArgs.GetArg("-rpcport", port); // Obtain event base raii_event_base base = obtain_event_base(); diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 4f369b241644..ca6d6b94102c 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -7,6 +7,7 @@ #include "chainparamsbase.h" #include "compat.h" #include "util.h" +#include "utilstrencodings.h" #include "netbase.h" #include "rpc/protocol.h" // For HTTP status codes #include "sync.h" diff --git a/src/netbase.cpp b/src/netbase.cpp index 1dbf7100db23..baf42f4e9e95 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -58,25 +58,6 @@ std::string GetNetworkName(enum Network net) { } } -void SplitHostPort(std::string in, int &portOut, std::string &hostOut) { - size_t colon = in.find_last_of(':'); - // if a : is found, and it either follows a [...], or no other : is in the string, treat it as port separator - bool fHaveColon = colon != in.npos; - bool fBracketed = fHaveColon && (in[0]=='[' && in[colon-1]==']'); // if there is a colon, and in[0]=='[', colon is not 0, so in[colon-1] is safe - bool fMultiColon = fHaveColon && (in.find_last_of(':',colon-1) != in.npos); - if (fHaveColon && (colon==0 || fBracketed || !fMultiColon)) { - int32_t n; - if (ParseInt32(in.substr(colon + 1), &n) && n > 0 && n < 0x10000) { - in = in.substr(0, colon); - portOut = n; - } - } - if (in.size()>0 && in[0] == '[' && in[in.size()-1] == ']') - hostOut = in.substr(1, in.size()-2); - else - hostOut = in; -} - bool static LookupIntern(const char *pszName, std::vector& vIP, unsigned int nMaxSolutions, bool fAllowLookup) { vIP.clear(); diff --git a/src/netbase.h b/src/netbase.h index 221986cba39e..dfb0c1d41c27 100644 --- a/src/netbase.h +++ b/src/netbase.h @@ -40,7 +40,6 @@ class proxyType enum Network ParseNetwork(std::string net); std::string GetNetworkName(enum Network net); -void SplitHostPort(std::string in, int &portOut, std::string &hostOut); bool SetProxy(enum Network net, const proxyType &addrProxy); bool GetProxy(enum Network net, proxyType &proxyInfoOut); bool IsProxy(const CNetAddr &addr); diff --git a/src/test/netbase_tests.cpp b/src/test/netbase_tests.cpp index d0af22d1ff67..ef7c49aabfe4 100644 --- a/src/test/netbase_tests.cpp +++ b/src/test/netbase_tests.cpp @@ -5,6 +5,7 @@ #include "netbase.h" #include "test/test_dash.h" +#include "utilstrencodings.h" #include diff --git a/src/utilstrencodings.cpp b/src/utilstrencodings.cpp index 682ae8de2555..9e67aba6e7db 100644 --- a/src/utilstrencodings.cpp +++ b/src/utilstrencodings.cpp @@ -91,6 +91,25 @@ std::vector ParseHex(const std::string& str) return ParseHex(str.c_str()); } +void SplitHostPort(std::string in, int &portOut, std::string &hostOut) { + size_t colon = in.find_last_of(':'); + // if a : is found, and it either follows a [...], or no other : is in the string, treat it as port separator + bool fHaveColon = colon != in.npos; + bool fBracketed = fHaveColon && (in[0]=='[' && in[colon-1]==']'); // if there is a colon, and in[0]=='[', colon is not 0, so in[colon-1] is safe + bool fMultiColon = fHaveColon && (in.find_last_of(':',colon-1) != in.npos); + if (fHaveColon && (colon==0 || fBracketed || !fMultiColon)) { + int32_t n; + if (ParseInt32(in.substr(colon + 1), &n) && n > 0 && n < 0x10000) { + in = in.substr(0, colon); + portOut = n; + } + } + if (in.size()>0 && in[0] == '[' && in[in.size()-1] == ']') + hostOut = in.substr(1, in.size()-2); + else + hostOut = in; +} + std::string EncodeBase64(const unsigned char* pch, size_t len) { static const char *pbase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; diff --git a/src/utilstrencodings.h b/src/utilstrencodings.h index a35cea289caf..94981127d562 100644 --- a/src/utilstrencodings.h +++ b/src/utilstrencodings.h @@ -48,6 +48,7 @@ std::string DecodeBase32(const std::string& str); std::string EncodeBase32(const unsigned char* pch, size_t len); std::string EncodeBase32(const std::string& str); +void SplitHostPort(std::string in, int &portOut, std::string &hostOut); std::string i64tostr(int64_t n); std::string itostr(int n); int64_t atoi64(const char* psz); From 6d856aeb43147707b608bafd29f5a02a90ca424d Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sun, 16 Jul 2017 11:49:45 -0700 Subject: [PATCH 22/28] Merge #10820: Use cpuid intrinsics instead of asm code 674848fe1 Clarify entropy source (Pieter Wuille) a9e82f651 Use cpuid intrinsics instead of asm code (Pieter Wuille) Pull request description: Less platform-specific code is better. Tree-SHA512: 14f1b9accd9882859acdf516d2ada7ccb0ad92a3b3edf95b9cb8a8e514d4b1748d4555bcfb560779792c4f664f920d681ae42e9cebd0e6410f13f94c3a8729a0 --- src/random.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/random.cpp b/src/random.cpp index b171b3dabfed..41146451c48e 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -36,6 +36,10 @@ #include +#if defined(__x86_64__) || defined(__amd64__) || defined(__i386__) +#include +#endif + #include #include @@ -72,18 +76,9 @@ static bool rdrand_supported = false; static constexpr uint32_t CPUID_F1_ECX_RDRAND = 0x40000000; static void RDRandInit() { - uint32_t eax, ecx, edx; -#if defined(__i386__) && ( defined(__PIC__) || defined(__PIE__)) - // Avoid clobbering ebx, as that is used for PIC on x86. - uint32_t tmp; - __asm__ ("mov %%ebx, %1; cpuid; mov %1, %%ebx": "=a"(eax), "=g"(tmp), "=c"(ecx), "=d"(edx) : "a"(1)); -#else - uint32_t ebx; - __asm__ ("cpuid": "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) : "a"(1)); -#endif - //! When calling cpuid function #1, ecx register will have this set if RDRAND is available. - if (ecx & CPUID_F1_ECX_RDRAND) { - LogPrintf("Using RdRand as entropy source\n"); + uint32_t eax, ebx, ecx, edx; + if (__get_cpuid(1, &eax, &ebx, &ecx, &edx) && (ecx & CPUID_F1_ECX_RDRAND)) { + LogPrintf("Using RdRand as an additional entropy source\n"); rdrand_supported = true; } hwrand_initialized.store(true); From d7057d429ea840b95d51230e0d829d9a3faa6981 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sun, 16 Jul 2017 11:55:57 -0700 Subject: [PATCH 23/28] Merge #10766: Building Environment: Set ARFLAGS to cr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 912da1dcc Use AC_ARG_VAR to set ARFLAGS. (René Nyffenegger) Pull request description: Override the default of ARFLAGS of `cru` to `cr`. When building, ar produces a warning for each archive, for example ``` AR libbitcoin_server.a /usr/bin/ar: `u' modifier ignored since `D' is the default (see `U') ``` Since `u` is the default anyway, it cannot hurt to remove it. Tree-SHA512: 7466764f847b70f0f67db25dac87a7794477abf1997cb946682f394fe80ae86ac3ed52cbadb35f0c18a87467755bde5a5158430444cd26fb60fa363cc7bd486d --- configure.ac | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/configure.ac b/configure.ac index c6446f1d7927..6f7ce329d955 100644 --- a/configure.ac +++ b/configure.ac @@ -19,6 +19,12 @@ BITCOIN_GUI_NAME=dash-qt BITCOIN_CLI_NAME=dash-cli BITCOIN_TX_NAME=dash-tx +dnl Unless the user specified ARFLAGS, force it to be cr +AC_ARG_VAR(ARFLAGS, [Flags for the archiver, defaults to if not set]) +if test "x${ARFLAGS+set}" != "xset"; then + ARFLAGS="cr" +fi + AC_CANONICAL_HOST AH_TOP([#ifndef DASH_CONFIG_H]) @@ -1344,4 +1350,5 @@ echo " CPPFLAGS = $CPPFLAGS" echo " CXX = $CXX" echo " CXXFLAGS = $CXXFLAGS" echo " LDFLAGS = $LDFLAGS" +echo " ARFLAGS = $ARFLAGS" echo From c097ab84dfe8065cb077aea85e58def095c2668e Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sun, 16 Jul 2017 11:58:37 -0700 Subject: [PATCH 24/28] Merge #10840: Remove duplicate include c53369cc2 Remove duplicate include (practicalswift) Pull request description: Remove duplicate include. Introduced in 5c643241e5d98992c0d5487b65e9c7b6d8005d1a. Tree-SHA512: c273cb60824b3a2b2bdebdc4fc84b309d66042d616ccfc9a7b1ee55380af0ab7d1ae059391b3b46063847087a1985e2491d4ce203a31a2b1c586e8fd531d9336 --- src/dash-cli.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/dash-cli.cpp b/src/dash-cli.cpp index 6f62ca46579b..9d873b167b29 100644 --- a/src/dash-cli.cpp +++ b/src/dash-cli.cpp @@ -11,7 +11,6 @@ #include "chainparamsbase.h" #include "clientversion.h" #include "fs.h" -#include "utilstrencodings.h" #include "rpc/client.h" #include "rpc/protocol.h" #include "stacktraces.h" From 188f4a75227ccbe314d93822e5f328d39f2a7a8e Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sun, 16 Jul 2017 12:07:34 -0700 Subject: [PATCH 25/28] Merge #10735: Avoid static analyzer warnings regarding uninitialized arguments 6835cb0ab Avoid static analyzer warnings regarding uninitialized arguments (practicalswift) Pull request description: Avoid static analyzer warnings regarding _"Function call argument is a pointer to uninitialized value"_ in cases where we are intentionally using such arguments. This is achieved by using `f(b.begin(), b.end())` (`std::array`) instead of `f(b, b + N)` (`char b[N]`). Rationale: * Reduce false positives by guiding static analyzers regarding our intentions. Before this commit: ```shell $ clang-tidy-3.5 -checks=* src/bench/base58.cpp bench/base58.cpp:23:9: warning: Function call argument is a pointer to uninitialized value [clang-analyzer-core.CallAndMessage] EncodeBase58(b, b + 32); ^ $ clang-tidy-3.5 -checks=* src/bench/verify_script.cpp bench/verify_script.cpp:59:5: warning: Function call argument is a pointer to uninitialized value [clang-analyzer-core.CallAndMessage] key.Set(vchKey, vchKey + 32, false); ^ $ ``` After this commit: ```shell $ clang-tidy-3.5 -checks=* src/bench/base58.cpp $ clang-tidy-3.5 -checks=* src/bench/verify_script.cpp $ ``` Tree-SHA512: 5814a320ca8b959d0954bb64393424bcad73f942d2e988de1cd6788f39153b93900325532f2e340de02d740a3953385d212ae08e7ec72bb4c394a40475f251df --- src/bench/base58.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/bench/base58.cpp b/src/bench/base58.cpp index 3319c179bf54..65e27a615d93 100644 --- a/src/bench/base58.cpp +++ b/src/bench/base58.cpp @@ -7,34 +7,37 @@ #include "validation.h" #include "base58.h" +#include #include #include static void Base58Encode(benchmark::State& state) { - unsigned char buff[32] = { - 17, 79, 8, 99, 150, 189, 208, 162, 22, 23, 203, 163, 36, 58, 147, - 227, 139, 2, 215, 100, 91, 38, 11, 141, 253, 40, 117, 21, 16, 90, - 200, 24 + static const std::array buff = { + { + 17, 79, 8, 99, 150, 189, 208, 162, 22, 23, 203, 163, 36, 58, 147, + 227, 139, 2, 215, 100, 91, 38, 11, 141, 253, 40, 117, 21, 16, 90, + 200, 24 + } }; - unsigned char* b = buff; while (state.KeepRunning()) { - EncodeBase58(b, b + 32); + EncodeBase58(buff.begin(), buff.end()); } } static void Base58CheckEncode(benchmark::State& state) { - unsigned char buff[32] = { - 17, 79, 8, 99, 150, 189, 208, 162, 22, 23, 203, 163, 36, 58, 147, - 227, 139, 2, 215, 100, 91, 38, 11, 141, 253, 40, 117, 21, 16, 90, - 200, 24 + static const std::array buff = { + { + 17, 79, 8, 99, 150, 189, 208, 162, 22, 23, 203, 163, 36, 58, 147, + 227, 139, 2, 215, 100, 91, 38, 11, 141, 253, 40, 117, 21, 16, 90, + 200, 24 + } }; - unsigned char* b = buff; std::vector vch; - vch.assign(b, b + 32); + vch.assign(buff.begin(), buff.end()); while (state.KeepRunning()) { EncodeBase58Check(vch); } From 2b9216e98df08a67307ccf6b012431190169f67e Mon Sep 17 00:00:00 2001 From: Pasta Date: Wed, 17 Jul 2019 18:59:02 -0500 Subject: [PATCH 26/28] /s/BTC/DASH Signed-off-by: Pasta --- doc/REST-interface.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/REST-interface.md b/doc/REST-interface.md index 3a3ada047a83..d360d8981a42 100644 --- a/doc/REST-interface.md +++ b/doc/REST-interface.md @@ -90,7 +90,7 @@ Only supports JSON as output format. * bytes : (numeric) size of the TX mempool in bytes * usage : (numeric) total TX mempool memory usage * maxmempool : (numeric) maximum memory usage for the mempool in bytes -* mempoolminfee : (numeric) minimum feerate (BTC per KB) for tx to be accepted +* mempoolminfee : (numeric) minimum feerate (DASH per KB) for tx to be accepted `GET /rest/mempool/contents.json` From 0eae9ed90d7b21943d27ec9613f9fcd8ec5ab351 Mon Sep 17 00:00:00 2001 From: Pasta Date: Wed, 17 Jul 2019 19:03:16 -0500 Subject: [PATCH 27/28] remove witness comment/text Signed-off-by: Pasta --- src/rpc/misc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp index f2b9fc9d161d..4e98a61ee197 100644 --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -335,7 +335,7 @@ UniValue validateaddress(const JSONRPCRequest& request) " \"ismine\" : true|false, (boolean) If the address is yours or not\n" " \"iswatchonly\" : true|false, (boolean) If the address is watchonly\n" " \"isscript\" : true|false, (boolean) If the key is a script\n" - " \"script\" : \"type\" (string, optional) The output script type. Possible types: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_keyhash, witness_v0_scripthash\n" + " \"script\" : \"type\" (string, optional) The output script type. Possible types: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata\n" " \"hex\" : \"hex\", (string, optional) The redeemscript for the p2sh address\n" " \"addresses\" (string, optional) Array of addresses associated with the known redeemscript\n" " [\n" From a4f046cd0f7907df632d359c701f1b198902a3b1 Mon Sep 17 00:00:00 2001 From: PastaPastaPasta Date: Thu, 18 Jul 2019 00:04:57 +0000 Subject: [PATCH 28/28] adjust formatting from review configure.ac Co-Authored-By: UdjinM6 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 6f7ce329d955..c68d83079a78 100644 --- a/configure.ac +++ b/configure.ac @@ -1350,5 +1350,5 @@ echo " CPPFLAGS = $CPPFLAGS" echo " CXX = $CXX" echo " CXXFLAGS = $CXXFLAGS" echo " LDFLAGS = $LDFLAGS" -echo " ARFLAGS = $ARFLAGS" +echo " ARFLAGS = $ARFLAGS" echo