From a15668be1505b9078ebd8867ff1d577678580a62 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Wed, 4 Apr 2018 17:50:14 -0400 Subject: [PATCH 1/7] Merge #12460: Assert CPubKey::ValidLength to the pubkey's header-relevant size f8c249ab91 Assert CPubKey::ValidLength to the pubkey's header-relevent size (Ben Woosley) Pull request description: A pubkey's length is specific to its type which is indicated by its header value. GetLen returns the header-indicated length, so this change ensures that a key matches its header-indicated length. And replace some magic values with their constant equivalents. Tree-SHA512: b727b39a631babe0932326396fc4d796ade8ec1e37454ff0c709ae9b78ecbd0cfdf59d84089ba8415e6efa7bc180e3cd39a14ddaf0871cbac54b96851e1b7b44 --- src/script/interpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 5e8a5ca9f8..628b7fbfb6 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -83,7 +83,7 @@ bool static IsCompressedOrUncompressedPubKey(const valtype &vchPubKey) { } bool static IsCompressedPubKey(const valtype &vchPubKey) { - if (vchPubKey.size() != 33) { + if (vchPubKey.size() != CPubKey::COMPRESSED_PUBLIC_KEY_SIZE) { // Non-canonical public key: invalid length for compressed key return false; } From bb0200bf0471efa991142f140ab4b3e471472911 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 10 Apr 2018 15:27:14 +0200 Subject: [PATCH 2/7] Merge #12852: [doc] devtools: Setup ots git integration fa385c3 [doc] devtools: Setup ots git integration (MarcoFalke) Pull request description: Document the simple steps on how to set up ots git integration. Tree-SHA512: 1b9f99bfaa6cd9dc581243d3a3584301645e95450acc3b5898dcdb53849569de16bb8ef2676b18f6b8dd402de10aee80119e15c1b28cef36f17ad121cbba2ba3 --- contrib/devtools/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contrib/devtools/README.md b/contrib/devtools/README.md index 535f2906e5..41bdd33e74 100644 --- a/contrib/devtools/README.md +++ b/contrib/devtools/README.md @@ -121,6 +121,14 @@ Configuring the github-merge tool for the bitcoin repository is done in the foll git config githubmerge.testcmd "make -j4 check" (adapt to whatever you want to use for testing) git config --global user.signingkey mykeyid (if you want to GPG sign) +Create and verify timestamps of merge commits +--------------------------------------------- +To create or verify timestamps on the merge commits, install the OpenTimestamps +client via `pip3 install opentimestamps-client`. Then, dowload the gpg wrapper +`ots-git-gpg-wrapper.sh` and set it as git's `gpg.program`. See +[the ots git integration documentation](https://github.com/opentimestamps/opentimestamps-client/blob/master/doc/git-integration.md#usage) +for further details. + optimize-pngs.py ================ From 06e45e3753189c25677bff6460d26c3f7c8f0198 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Wed, 13 Jun 2018 10:40:55 -0400 Subject: [PATCH 3/7] Merge #13350: [tests] Add logging to provide anchor points when debugging p2p_sendheaders 2ce81867b2 [tests] Add logging to provide anchor points when debugging failures. (Lowell Manners) Pull request description: refs #12453 Tree-SHA512: 0ad432bd848723a5b813df4d35fcd8c81d152f042499c8340a9a2a9b7918d6e785efbf9f07b63b6c0253a949044cebdb51802971c09fb8dde0efa5169f34ef20 --- test/functional/p2p_sendheaders.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/functional/p2p_sendheaders.py b/test/functional/p2p_sendheaders.py index c96e40cd7c..6860cac538 100755 --- a/test/functional/p2p_sendheaders.py +++ b/test/functional/p2p_sendheaders.py @@ -423,18 +423,21 @@ class SendHeadersTest(BitcoinTestFramework): inv_node.check_last_inv_announcement(inv=[tip]) test_node.check_last_inv_announcement(inv=[tip]) if i == 0: - self.log.debug("Just get the data -- shouldn't cause headers announcements to resume") + # Just get the data -- shouldn't cause headers announcements to resume test_node.send_get_data([tip]) test_node.wait_for_block(tip) elif i == 1: - self.log.debug("Send a getheaders message that shouldn't trigger headers announcements to resume (best header sent will be too old)") + # Send a getheaders message that shouldn't trigger headers announcements + # to resume (best header sent will be too old) test_node.send_get_headers(locator=[fork_point], hashstop=new_block_hashes[1]) test_node.send_get_data([tip]) test_node.wait_for_block(tip) elif i == 2: + # This time, try sending either a getheaders to trigger resumption + # of headers announcements, or mine a new block and inv it, also + # triggering resumption of headers announcements. test_node.send_get_data([tip]) test_node.wait_for_block(tip) - self.log.debug("This time, try sending either a getheaders to trigger resumption of headers announcements, or mine a new block and inv it, also triggering resumption of headers announcements.") if j == 0: test_node.send_get_headers(locator=[tip], hashstop=0) test_node.sync_with_ping() From c7c810772d4a551ed5afaf80faa4d0011b9bfc63 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 11 Jul 2018 11:40:44 +0200 Subject: [PATCH 4/7] Merge #13586: refactor: add benchmarks to bech32::Encode/Decode 189cf35f3e6d2cc9ed08eb23dd0ea36be28b6c11 Add simple bech32 benchmarks (Karl-Johan Alm) Pull request description: This PR adds benchmarks to `Encode()`/`Decode()`. The benchmark commit is duplicated in #13632. Tree-SHA512: 102a193e4af58c9cb23c66d3dc7e174aa6328edab0ed74f92deb7804db5c3d0601807b3e25a5472b5c72d6113cde0dbc9976315644671a8f14ecf349967dbaaa --- src/Makefile.bench.include | 1 + src/bench/bech32.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/bench/bech32.cpp diff --git a/src/Makefile.bench.include b/src/Makefile.bench.include index 86d76f8f49..ac11f46494 100644 --- a/src/Makefile.bench.include +++ b/src/Makefile.bench.include @@ -32,6 +32,7 @@ bench_bench_dash_SOURCES = \ bench/mempool_eviction.cpp \ bench/util_time.cpp \ bench/base58.cpp \ + bench/bech32.cpp \ bench/lockedpool.cpp \ bench/poly1305.cpp \ bench/prevector.cpp \ diff --git a/src/bench/bech32.cpp b/src/bench/bech32.cpp new file mode 100644 index 0000000000..131fac6ab0 --- /dev/null +++ b/src/bench/bech32.cpp @@ -0,0 +1,38 @@ +// Copyright (c) 2018 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include + +#include +#include +#include + +#include +#include + + +static void Bech32Encode(benchmark::State& state) +{ + std::vector v = ParseHex("c97f5a67ec381b760aeaf67573bc164845ff39a3bb26a1cee401ac67243b48db"); + std::vector tmp = {0}; + tmp.reserve(1 + 32 * 8 / 5); + ConvertBits<8, 5, true>([&](unsigned char c) { tmp.push_back(c); }, v.begin(), v.end()); + while (state.KeepRunning()) { + bech32::Encode("bc", tmp); + } +} + + +static void Bech32Decode(benchmark::State& state) +{ + std::string addr = "bc1qkallence7tjawwvy0dwt4twc62qjgaw8f4vlhyd006d99f09"; + std::vector vch; + while (state.KeepRunning()) { + bech32::Decode(addr); + } +} + + +BENCHMARK(Bech32Encode, 800 * 1000); +BENCHMARK(Bech32Decode, 800 * 1000); From 1674f523fee172bc3eb3770d7e0bfd24c353fdd5 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Fri, 13 Jul 2018 20:34:35 +0100 Subject: [PATCH 5/7] Merge #12944: [wallet] ScanforWalletTransactions should mark input txns as dirty 3c292cc19 ScanforWalletTransactions should mark input txns as dirty (Gregory Sanders) Pull request description: I'm hitting a corner case in my mainnet wallet where I load a restore a wallet, call `rescanblockchain` from RPC, and it's "double counting" an output I've sent to myself since currently it never marks input transactions as dirty. This is fixed by a restart of the wallet. Note that this only happens with keys with birthdate *after* the blocks containing the spent funds which gets scanned on startup, so it's hard to test without a set seed function. Tree-SHA512: ee1fa152bb054b57ab4c734e355df10d241181e0372c81d583be61678fffbabe5ae60b09b05dc1bbbcfb4838df9d8538791d4c1d80a09b84d78ad2f50dcb0a61 --- src/wallet/wallet.cpp | 6 +++--- src/wallet/wallet.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index e0573ea9a6..6da5cadea9 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1420,10 +1420,10 @@ void CWallet::MarkConflicted(const uint256& hashBlock, const uint256& hashTx) fAnonymizableTallyCachedNonDenom = false; } -void CWallet::SyncTransaction(const CTransactionRef& ptx, const CBlockIndex *pindex, int posInBlock) { +void CWallet::SyncTransaction(const CTransactionRef& ptx, const CBlockIndex *pindex, int posInBlock, bool update_tx) { const CTransaction& tx = *ptx; - if (!AddToWalletIfInvolvingMe(ptx, pindex, posInBlock, true)) + if (!AddToWalletIfInvolvingMe(ptx, pindex, posInBlock, update_tx)) return; // Not one of ours // If a transaction changes 'conflicted' state, that changes the balance @@ -2221,7 +2221,7 @@ CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, CBlock break; } for (size_t posInBlock = 0; posInBlock < block.vtx.size(); ++posInBlock) { - AddToWalletIfInvolvingMe(block.vtx[posInBlock], pindex, posInBlock, fUpdate); + SyncTransaction(block.vtx[posInBlock], pindex, posInBlock, fUpdate); } } else { ret = pindex; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 10c9c211ea..d85743f80c 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -730,9 +730,9 @@ private: void SyncMetaData(std::pair); - /* Used by TransactionAddedToMemorypool/BlockConnected/Disconnected. + /* Used by TransactionAddedToMemorypool/BlockConnected/Disconnected/ScanForWalletTransactions. * Should be called with pindexBlock and posInBlock if this is for a transaction that is included in a block. */ - void SyncTransaction(const CTransactionRef& tx, const CBlockIndex *pindex = nullptr, int posInBlock = 0) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); + void SyncTransaction(const CTransactionRef& tx, const CBlockIndex *pindex = nullptr, int posInBlock = 0, bool update_tx = true) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); /* HD derive new child key (on internal or external chain) */ void DeriveNewChildKey(WalletBatch &batch, const CKeyMetadata& metadata, CKey& secretRet, uint32_t nAccountIndex, bool fInternal /*= false*/) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); From 526b4ede3a49215f2f42eb89b3c9d30c5ece79fb Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sat, 14 Jul 2018 13:08:26 -0400 Subject: [PATCH 6/7] Merge #13138: [tests] Remove accounts from wallet_importprunedfunds.py 38040c34e1 [tests] Remove accounts from wallet_importprunedfunds.py (John Newbery) Pull request description: This was split from #13075 to not block review/merge of that PR. Tree-SHA512: 631d7139ed2bda5222ec395cc75720261e2e1f741dba04723d09fe04ef6cf92222a3679d886026ec33e2db2d1e2fa1a0f36c2451581d0f733a9939a98c7118ab --- test/functional/wallet_importprunedfunds.py | 1 - 1 file changed, 1 deletion(-) diff --git a/test/functional/wallet_importprunedfunds.py b/test/functional/wallet_importprunedfunds.py index 0cdd694c26..7dd9566a0b 100755 --- a/test/functional/wallet_importprunedfunds.py +++ b/test/functional/wallet_importprunedfunds.py @@ -15,7 +15,6 @@ class ImportPrunedFundsTest(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 2 - self.extra_args = [['-deprecatedrpc=accounts']] * 2 def run_test(self): self.log.info("Mining blocks...") From 2b7f03e256f95bd020126847d8de7b3e118f7c35 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 17 Jul 2018 08:55:45 -0400 Subject: [PATCH 7/7] Merge #13682: bench: Remove unused variable fa39f674ae bench: Remove unused variable (practicalswift) Pull request description: Remove unused variable `vch`. Tree-SHA512: 624d206d27453ec071d20ca52d7f9e142710ebe7529fc793beb98a61c6a74ad481f4433d14401b7761070746d99e0aa35dd67568a017b18617d6be88de6f3105 --- src/bench/bech32.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/bench/bech32.cpp b/src/bench/bech32.cpp index 131fac6ab0..3c4b453a23 100644 --- a/src/bench/bech32.cpp +++ b/src/bench/bech32.cpp @@ -27,7 +27,6 @@ static void Bech32Encode(benchmark::State& state) static void Bech32Decode(benchmark::State& state) { std::string addr = "bc1qkallence7tjawwvy0dwt4twc62qjgaw8f4vlhyd006d99f09"; - std::vector vch; while (state.KeepRunning()) { bech32::Decode(addr); }