diff options
author | Andrew Chow <github@achow101.com> | 2023-05-11 10:56:40 -0400 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2023-05-11 10:57:23 -0400 |
commit | ac5b9f37dee708e0b10f8c6d591ab93454a1f3bb (patch) | |
tree | 48887ea6b68789c860f384f8ea691048655632bf | |
parent | 36c15d7d5cf6035bf76e54b88364373671e86337 (diff) | |
parent | 97f5e28830dfa5786cdc5df62e245e03fa393e19 (diff) |
Merge bitcoin/bitcoin#27614: [24.1] Backports for rc3
97f5e28830dfa5786cdc5df62e245e03fa393e19 doc: update release notes for 24.1rc3 (fanquake)
7e9c7ae810994bddd83b53ff5804b02345e4bc2f doc: update manual pages for v24.1rc3 (fanquake)
abb9fa0c81107b4db792ee10b93aed618a42684e build: bump version to v24.1rc3 (fanquake)
128da6e41fc2acc5bd1f4e2bddf2953f2fa62a68 net_processing: Boost inv trickle rate (Anthony Towns)
a9a861af2b4b1c0a17b8abda34cb741170e12d7d txmempool: have CompareDepthAndScore sort missing txs first (Anthony Towns)
ec7cd33c9c70af5903bf5dbf1056d42868de6f43 p2p: Avoid prematurely clearing download state for other peers (Suhas Daftuar)
Pull request description:
Backports for rc3. Currently:
* https://github.com/bitcoin/bitcoin/pull/27608
* https://github.com/bitcoin/bitcoin/pull/27610
ACKs for top commit:
josibake:
ACK https://github.com/bitcoin/bitcoin/pull/27614/commits/97f5e28830dfa5786cdc5df62e245e03fa393e19
dergoegge:
ACK 97f5e28830dfa5786cdc5df62e245e03fa393e19
achow101:
ACK 97f5e28830dfa5786cdc5df62e245e03fa393e19
glozow:
ACK 97f5e28830dfa5786cdc5df62e245e03fa393e19
brunoerg:
ACK 97f5e28830dfa5786cdc5df62e245e03fa393e19
hebasto:
ACK 97f5e28830dfa5786cdc5df62e245e03fa393e19, commits were backported locally, got zero diff.
Tree-SHA512: 09572285ed1e8169d7e77d12ec438586dab54c86064de85d0e743564e601686f884bf74f2bf8ed1be73bddcd7db6da4277c6dd6b9732e7eca383e108f8f37d58
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | doc/man/bitcoin-cli.1 | 6 | ||||
-rw-r--r-- | doc/man/bitcoin-qt.1 | 6 | ||||
-rw-r--r-- | doc/man/bitcoin-tx.1 | 6 | ||||
-rw-r--r-- | doc/man/bitcoin-util.1 | 6 | ||||
-rw-r--r-- | doc/man/bitcoin-wallet.1 | 6 | ||||
-rw-r--r-- | doc/man/bitcoind.1 | 6 | ||||
-rw-r--r-- | doc/release-notes.md | 10 | ||||
-rw-r--r-- | src/net_processing.cpp | 34 | ||||
-rw-r--r-- | src/txmempool.cpp | 11 |
10 files changed, 59 insertions, 34 deletions
diff --git a/configure.ac b/configure.ac index 3f948d0479..8afbca3da1 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ([2.69]) define(_CLIENT_VERSION_MAJOR, 24) define(_CLIENT_VERSION_MINOR, 1) define(_CLIENT_VERSION_BUILD, 0) -define(_CLIENT_VERSION_RC, 2) +define(_CLIENT_VERSION_RC, 3) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2022) define(_COPYRIGHT_HOLDERS,[The %s developers]) diff --git a/doc/man/bitcoin-cli.1 b/doc/man/bitcoin-cli.1 index bd79384783..e3bbcc18e5 100644 --- a/doc/man/bitcoin-cli.1 +++ b/doc/man/bitcoin-cli.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH BITCOIN-CLI "1" "April 2023" "bitcoin-cli v24.1.0rc2" "User Commands" +.TH BITCOIN-CLI "1" "May 2023" "bitcoin-cli v24.1.0rc3" "User Commands" .SH NAME -bitcoin-cli \- manual page for bitcoin-cli v24.1.0rc2 +bitcoin-cli \- manual page for bitcoin-cli v24.1.0rc3 .SH SYNOPSIS .B bitcoin-cli [\fI\,options\/\fR] \fI\,<command> \/\fR[\fI\,params\/\fR] \fI\,Send command to Bitcoin Core\/\fR @@ -15,7 +15,7 @@ bitcoin-cli \- manual page for bitcoin-cli v24.1.0rc2 .B bitcoin-cli [\fI\,options\/\fR] \fI\,help <command> Get help for a command\/\fR .SH DESCRIPTION -Bitcoin Core RPC client version v24.1.0rc2 +Bitcoin Core RPC client version v24.1.0rc3 .SH OPTIONS .HP \-? diff --git a/doc/man/bitcoin-qt.1 b/doc/man/bitcoin-qt.1 index f8b8069806..2f05944289 100644 --- a/doc/man/bitcoin-qt.1 +++ b/doc/man/bitcoin-qt.1 @@ -1,12 +1,12 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH BITCOIN-QT "1" "April 2023" "bitcoin-qt v24.1.0rc2" "User Commands" +.TH BITCOIN-QT "1" "May 2023" "bitcoin-qt v24.1.0rc3" "User Commands" .SH NAME -bitcoin-qt \- manual page for bitcoin-qt v24.1.0rc2 +bitcoin-qt \- manual page for bitcoin-qt v24.1.0rc3 .SH SYNOPSIS .B bitcoin-qt [\fI\,command-line options\/\fR] .SH DESCRIPTION -Bitcoin Core version v24.1.0rc2 +Bitcoin Core version v24.1.0rc3 .SH OPTIONS .HP \-? diff --git a/doc/man/bitcoin-tx.1 b/doc/man/bitcoin-tx.1 index 595ee2d9c1..bcfd1994a5 100644 --- a/doc/man/bitcoin-tx.1 +++ b/doc/man/bitcoin-tx.1 @@ -1,7 +1,7 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH BITCOIN-TX "1" "April 2023" "bitcoin-tx v24.1.0rc2" "User Commands" +.TH BITCOIN-TX "1" "May 2023" "bitcoin-tx v24.1.0rc3" "User Commands" .SH NAME -bitcoin-tx \- manual page for bitcoin-tx v24.1.0rc2 +bitcoin-tx \- manual page for bitcoin-tx v24.1.0rc3 .SH SYNOPSIS .B bitcoin-tx [\fI\,options\/\fR] \fI\,<hex-tx> \/\fR[\fI\,commands\/\fR] \fI\,Update hex-encoded bitcoin transaction\/\fR @@ -9,7 +9,7 @@ bitcoin-tx \- manual page for bitcoin-tx v24.1.0rc2 .B bitcoin-tx [\fI\,options\/\fR] \fI\,-create \/\fR[\fI\,commands\/\fR] \fI\,Create hex-encoded bitcoin transaction\/\fR .SH DESCRIPTION -Bitcoin Core bitcoin\-tx utility version v24.1.0rc2 +Bitcoin Core bitcoin\-tx utility version v24.1.0rc3 .SH OPTIONS .HP \-? diff --git a/doc/man/bitcoin-util.1 b/doc/man/bitcoin-util.1 index abdcdee3ef..ca89a9fe16 100644 --- a/doc/man/bitcoin-util.1 +++ b/doc/man/bitcoin-util.1 @@ -1,12 +1,12 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH BITCOIN-UTIL "1" "April 2023" "bitcoin-util v24.1.0rc2" "User Commands" +.TH BITCOIN-UTIL "1" "May 2023" "bitcoin-util v24.1.0rc3" "User Commands" .SH NAME -bitcoin-util \- manual page for bitcoin-util v24.1.0rc2 +bitcoin-util \- manual page for bitcoin-util v24.1.0rc3 .SH SYNOPSIS .B bitcoin-util [\fI\,options\/\fR] [\fI\,commands\/\fR] \fI\,Do stuff\/\fR .SH DESCRIPTION -Bitcoin Core bitcoin\-util utility version v24.1.0rc2 +Bitcoin Core bitcoin\-util utility version v24.1.0rc3 .SH OPTIONS .HP \-? diff --git a/doc/man/bitcoin-wallet.1 b/doc/man/bitcoin-wallet.1 index b824587886..b815dc26f4 100644 --- a/doc/man/bitcoin-wallet.1 +++ b/doc/man/bitcoin-wallet.1 @@ -1,9 +1,9 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH BITCOIN-WALLET "1" "April 2023" "bitcoin-wallet v24.1.0rc2" "User Commands" +.TH BITCOIN-WALLET "1" "May 2023" "bitcoin-wallet v24.1.0rc3" "User Commands" .SH NAME -bitcoin-wallet \- manual page for bitcoin-wallet v24.1.0rc2 +bitcoin-wallet \- manual page for bitcoin-wallet v24.1.0rc3 .SH DESCRIPTION -Bitcoin Core bitcoin\-wallet version v24.1.0rc2 +Bitcoin Core bitcoin\-wallet version v24.1.0rc3 .PP bitcoin\-wallet is an offline tool for creating and interacting with Bitcoin Core wallet files. By default bitcoin\-wallet will act on wallets in the default mainnet wallet directory in the datadir. diff --git a/doc/man/bitcoind.1 b/doc/man/bitcoind.1 index 8bb9688585..5c950b2155 100644 --- a/doc/man/bitcoind.1 +++ b/doc/man/bitcoind.1 @@ -1,12 +1,12 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. -.TH BITCOIND "1" "April 2023" "bitcoind v24.1.0rc2" "User Commands" +.TH BITCOIND "1" "May 2023" "bitcoind v24.1.0rc3" "User Commands" .SH NAME -bitcoind \- manual page for bitcoind v24.1.0rc2 +bitcoind \- manual page for bitcoind v24.1.0rc3 .SH SYNOPSIS .B bitcoind [\fI\,options\/\fR] \fI\,Start Bitcoin Core\/\fR .SH DESCRIPTION -Bitcoin Core version v24.1.0rc2 +Bitcoin Core version v24.1.0rc3 .SH OPTIONS .HP \-? diff --git a/doc/release-notes.md b/doc/release-notes.md index fcf9788a09..a0147f5ce0 100644 --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -1,9 +1,9 @@ -24.1rc2 Release Notes +24.1rc3 Release Notes ==================== -Bitcoin Core version 24.1rc2 is now available from: +Bitcoin Core version 24.1rc3 is now available from: - <https://bitcoincore.org/bin/bitcoin-core-24.1/test.rc2/> + <https://bitcoincore.org/bin/bitcoin-core-24.1/test.rc3/> This release includes new features, various bug fixes and performance improvements, as well as updated translations. @@ -41,6 +41,8 @@ unsupported systems. - #26878 I2P network optimizations - #26909 net: prevent peers.dat corruptions by only serializing once +- #27608 p2p: Avoid prematurely clearing download state for other peers +- #27610 Improve performance of p2p inv to send queues ### RPC and other APIs @@ -79,6 +81,7 @@ Credits Thanks to everyone who directly contributed to this release: - Andrew Chow +- Anthony Towns - Hennadii Stepanov - John Moffett - Jon Atack @@ -88,6 +91,7 @@ Thanks to everyone who directly contributed to this release: - Michael Ford - pablomartin4btc - Sebastian Falbesoner +- Suhas Daftuar - Thomas Nguyen - Vasil Dimov diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 3edc051034..7954dbf912 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -871,8 +871,11 @@ private: /** Remove this block from our tracked requested blocks. Called if: * - the block has been received from a peer * - the request for the block has timed out + * If "from_peer" is specified, then only remove the block if it is in + * flight from that peer (to avoid one peer's network traffic from + * affecting another's state). */ - void RemoveBlockRequest(const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main); + void RemoveBlockRequest(const uint256& hash, std::optional<NodeId> from_peer) EXCLUSIVE_LOCKS_REQUIRED(cs_main); /* Mark a block as in flight * Returns false, still setting pit, if the block was already in flight from the same peer @@ -1103,7 +1106,7 @@ bool PeerManagerImpl::IsBlockRequested(const uint256& hash) return mapBlocksInFlight.find(hash) != mapBlocksInFlight.end(); } -void PeerManagerImpl::RemoveBlockRequest(const uint256& hash) +void PeerManagerImpl::RemoveBlockRequest(const uint256& hash, std::optional<NodeId> from_peer) { auto it = mapBlocksInFlight.find(hash); if (it == mapBlocksInFlight.end()) { @@ -1112,6 +1115,12 @@ void PeerManagerImpl::RemoveBlockRequest(const uint256& hash) } auto [node_id, list_it] = it->second; + + if (from_peer && node_id != *from_peer) { + // Block was requested by another peer + return; + } + CNodeState *state = State(node_id); assert(state != nullptr); @@ -1147,7 +1156,7 @@ bool PeerManagerImpl::BlockRequested(NodeId nodeid, const CBlockIndex& block, st } // Make sure it's not listed somewhere already. - RemoveBlockRequest(hash); + RemoveBlockRequest(hash, std::nullopt); std::list<QueuedBlock>::iterator it = state->vBlocksInFlight.insert(state->vBlocksInFlight.end(), {&block, std::unique_ptr<PartiallyDownloadedBlock>(pit ? new PartiallyDownloadedBlock(&m_mempool) : nullptr)}); @@ -3140,6 +3149,11 @@ void PeerManagerImpl::ProcessBlock(CNode& node, const std::shared_ptr<const CBlo m_chainman.ProcessNewBlock(block, force_processing, min_pow_checked, &new_block); if (new_block) { node.m_last_block_time = GetTime<std::chrono::seconds>(); + // In case this block came from a different peer than we requested + // from, we can erase the block request now anyway (as we just stored + // this block to disk). + LOCK(cs_main); + RemoveBlockRequest(block->GetHash(), std::nullopt); } else { LOCK(cs_main); mapBlockSource.erase(block->GetHash()); @@ -4219,7 +4233,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, PartiallyDownloadedBlock& partialBlock = *(*queuedBlockIt)->partialBlock; ReadStatus status = partialBlock.InitData(cmpctblock, vExtraTxnForCompact); if (status == READ_STATUS_INVALID) { - RemoveBlockRequest(pindex->GetBlockHash()); // Reset in-flight state in case Misbehaving does not result in a disconnect + RemoveBlockRequest(pindex->GetBlockHash(), pfrom.GetId()); // Reset in-flight state in case Misbehaving does not result in a disconnect Misbehaving(*peer, 100, "invalid compact block"); return; } else if (status == READ_STATUS_FAILED) { @@ -4314,7 +4328,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, // process from some other peer. We do this after calling // ProcessNewBlock so that a malleated cmpctblock announcement // can't be used to interfere with block relay. - RemoveBlockRequest(pblock->GetHash()); + RemoveBlockRequest(pblock->GetHash(), std::nullopt); } } return; @@ -4346,7 +4360,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, PartiallyDownloadedBlock& partialBlock = *it->second.second->partialBlock; ReadStatus status = partialBlock.FillBlock(*pblock, resp.txn); if (status == READ_STATUS_INVALID) { - RemoveBlockRequest(resp.blockhash); // Reset in-flight state in case Misbehaving does not result in a disconnect + RemoveBlockRequest(resp.blockhash, pfrom.GetId()); // Reset in-flight state in case Misbehaving does not result in a disconnect Misbehaving(*peer, 100, "invalid compact block/non-matching block transactions"); return; } else if (status == READ_STATUS_FAILED) { @@ -4372,7 +4386,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, // though the block was successfully read, and rely on the // handling in ProcessNewBlock to ensure the block index is // updated, etc. - RemoveBlockRequest(resp.blockhash); // it is now an empty pointer + RemoveBlockRequest(resp.blockhash, pfrom.GetId()); // it is now an empty pointer fBlockRead = true; // mapBlockSource is used for potentially punishing peers and // updating which peers send us compact blocks, so the race @@ -4461,7 +4475,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, // Always process the block if we requested it, since we may // need it even when it's not a candidate for a new best tip. forceProcessing = IsBlockRequested(hash); - RemoveBlockRequest(hash); + RemoveBlockRequest(hash, pfrom.GetId()); // mapBlockSource is only used for punishing peers and setting // which peers send us compact blocks, so the race between here and // cs_main in ProcessNewBlock is fine. @@ -5580,7 +5594,9 @@ bool PeerManagerImpl::SendMessages(CNode* pto) // especially since we have many peers and some will draw much shorter delays. unsigned int nRelayedTransactions = 0; LOCK(tx_relay->m_bloom_filter_mutex); - while (!vInvTx.empty() && nRelayedTransactions < INVENTORY_BROADCAST_MAX) { + size_t broadcast_max{INVENTORY_BROADCAST_MAX + (tx_relay->m_tx_inventory_to_send.size()/1000)*5}; + broadcast_max = std::min<size_t>(1000, broadcast_max); + while (!vInvTx.empty() && nRelayedTransactions < broadcast_max) { // Fetch the top element from the heap std::pop_heap(vInvTx.begin(), vInvTx.end(), compareInvMempoolOrder); std::set<uint256>::iterator it = vInvTx.back(); diff --git a/src/txmempool.cpp b/src/txmempool.cpp index e1288b7346..d03ab75546 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -805,11 +805,16 @@ void CTxMemPool::check(const CCoinsViewCache& active_coins_tip, int64_t spendhei bool CTxMemPool::CompareDepthAndScore(const uint256& hasha, const uint256& hashb, bool wtxid) { + /* Return `true` if hasha should be considered sooner than hashb. Namely when: + * a is not in the mempool, but b is + * both are in the mempool and a has fewer ancestors than b + * both are in the mempool and a has a higher score than b + */ LOCK(cs); - indexed_transaction_set::const_iterator i = wtxid ? get_iter_from_wtxid(hasha) : mapTx.find(hasha); - if (i == mapTx.end()) return false; indexed_transaction_set::const_iterator j = wtxid ? get_iter_from_wtxid(hashb) : mapTx.find(hashb); - if (j == mapTx.end()) return true; + if (j == mapTx.end()) return false; + indexed_transaction_set::const_iterator i = wtxid ? get_iter_from_wtxid(hasha) : mapTx.find(hasha); + if (i == mapTx.end()) return true; uint64_t counta = i->GetCountWithAncestors(); uint64_t countb = j->GetCountWithAncestors(); if (counta == countb) { |