Skip to content

Commit

Permalink
Merge #29531: [25.x] backports
Browse files Browse the repository at this point in the history
27cfda1 doc: Update release notes for 25.2rc2 (Ava Chow)
daba5e2 doc: Update manpages for 25.2rc2 (Ava Chow)
8a0c980 build: Bump to 25.2rc2 (Ava Chow)
cf7d3a8 p2p: Don't consider blocks mutated if they don't connect to known prev block (Greg Sanders)
3eaaafa [test] IsBlockMutated unit tests (dergoegge)
0667441 [validation] Cache merkle root and witness commitment checks (dergoegge)
de97ecf [test] Add regression test for #27608 (dergoegge)
8cc4b24 [net processing] Don't process mutated blocks (dergoegge)
098f07d [validation] Merkle root malleation should be caught by IsBlockMutated (dergoegge)
8804c36 [validation] Introduce IsBlockMutated (dergoegge)
4f5baac [validation] Isolate merkle root checks (dergoegge)
f93be01 test: make sure keypool sizes do not change on `getrawchangeaddress`/`getnewaddress` failures (UdjinM6)
7c08ccf wallet: Avoid updating `ReserveDestination::nIndex` when `GetReservedDestination` fails (UdjinM6)

Pull request description:

  Backport:

  * #29510
  * #29412
  * #29524

ACKs for top commit:
  glozow:
    utACK 27cfda1

Tree-SHA512: 37feadd65d9ea55c0a92c9d2a6f74f87cafed3bc67f8deeaaafc5b7042f954e55ea34816612e1a49088f4f1906f104e00c7c3bec7affd1c1f48220b57a8769c5
  • Loading branch information
fanquake committed Mar 22, 2024
2 parents 1ce5acc + 27cfda1 commit d5bad0d
Show file tree
Hide file tree
Showing 17 changed files with 491 additions and 65 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ AC_PREREQ([2.69])
define(_CLIENT_VERSION_MAJOR, 25)
define(_CLIENT_VERSION_MINOR, 2)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_RC, 1)
define(_CLIENT_VERSION_RC, 2)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2023)
define(_COPYRIGHT_HOLDERS,[The %s developers])
Expand Down
6 changes: 3 additions & 3 deletions doc/man/bitcoin-cli.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH BITCOIN-CLI "1" "February 2024" "bitcoin-cli v25.2.0rc1" "User Commands"
.TH BITCOIN-CLI "1" "March 2024" "bitcoin-cli v25.2.0rc2" "User Commands"
.SH NAME
bitcoin-cli \- manual page for bitcoin-cli v25.2.0rc1
bitcoin-cli \- manual page for bitcoin-cli v25.2.0rc2
.SH SYNOPSIS
.B bitcoin-cli
[\fI\,options\/\fR] \fI\,<command> \/\fR[\fI\,params\/\fR] \fI\,Send command to Bitcoin Core\/\fR
Expand All @@ -15,7 +15,7 @@ bitcoin-cli \- manual page for bitcoin-cli v25.2.0rc1
.B bitcoin-cli
[\fI\,options\/\fR] \fI\,help <command> Get help for a command\/\fR
.SH DESCRIPTION
Bitcoin Core RPC client version v25.2.0rc1
Bitcoin Core RPC client version v25.2.0rc2
.SH OPTIONS
.HP
\-?
Expand Down
6 changes: 3 additions & 3 deletions doc/man/bitcoin-qt.1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH BITCOIN-QT "1" "February 2024" "bitcoin-qt v25.2.0rc1" "User Commands"
.TH BITCOIN-QT "1" "March 2024" "bitcoin-qt v25.2.0rc2" "User Commands"
.SH NAME
bitcoin-qt \- manual page for bitcoin-qt v25.2.0rc1
bitcoin-qt \- manual page for bitcoin-qt v25.2.0rc2
.SH SYNOPSIS
.B bitcoin-qt
[\fI\,command-line options\/\fR]
.SH DESCRIPTION
Bitcoin Core version v25.2.0rc1
Bitcoin Core version v25.2.0rc2
.SH OPTIONS
.HP
\-?
Expand Down
6 changes: 3 additions & 3 deletions doc/man/bitcoin-tx.1
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH BITCOIN-TX "1" "February 2024" "bitcoin-tx v25.2.0rc1" "User Commands"
.TH BITCOIN-TX "1" "March 2024" "bitcoin-tx v25.2.0rc2" "User Commands"
.SH NAME
bitcoin-tx \- manual page for bitcoin-tx v25.2.0rc1
bitcoin-tx \- manual page for bitcoin-tx v25.2.0rc2
.SH SYNOPSIS
.B bitcoin-tx
[\fI\,options\/\fR] \fI\,<hex-tx> \/\fR[\fI\,commands\/\fR] \fI\,Update hex-encoded bitcoin transaction\/\fR
.br
.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 v25.2.0rc1
Bitcoin Core bitcoin\-tx utility version v25.2.0rc2
.SH OPTIONS
.HP
\-?
Expand Down
6 changes: 3 additions & 3 deletions doc/man/bitcoin-util.1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH BITCOIN-UTIL "1" "February 2024" "bitcoin-util v25.2.0rc1" "User Commands"
.TH BITCOIN-UTIL "1" "March 2024" "bitcoin-util v25.2.0rc2" "User Commands"
.SH NAME
bitcoin-util \- manual page for bitcoin-util v25.2.0rc1
bitcoin-util \- manual page for bitcoin-util v25.2.0rc2
.SH SYNOPSIS
.B bitcoin-util
[\fI\,options\/\fR] [\fI\,commands\/\fR] \fI\,Do stuff\/\fR
.SH DESCRIPTION
Bitcoin Core bitcoin\-util utility version v25.2.0rc1
Bitcoin Core bitcoin\-util utility version v25.2.0rc2
.SH OPTIONS
.HP
\-?
Expand Down
6 changes: 3 additions & 3 deletions doc/man/bitcoin-wallet.1
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH BITCOIN-WALLET "1" "February 2024" "bitcoin-wallet v25.2.0rc1" "User Commands"
.TH BITCOIN-WALLET "1" "March 2024" "bitcoin-wallet v25.2.0rc2" "User Commands"
.SH NAME
bitcoin-wallet \- manual page for bitcoin-wallet v25.2.0rc1
bitcoin-wallet \- manual page for bitcoin-wallet v25.2.0rc2
.SH DESCRIPTION
Bitcoin Core bitcoin\-wallet version v25.2.0rc1
Bitcoin Core bitcoin\-wallet version v25.2.0rc2
.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.
Expand Down
6 changes: 3 additions & 3 deletions doc/man/bitcoind.1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH BITCOIND "1" "February 2024" "bitcoind v25.2.0rc1" "User Commands"
.TH BITCOIND "1" "March 2024" "bitcoind v25.2.0rc2" "User Commands"
.SH NAME
bitcoind \- manual page for bitcoind v25.2.0rc1
bitcoind \- manual page for bitcoind v25.2.0rc2
.SH SYNOPSIS
.B bitcoind
[\fI\,options\/\fR] \fI\,Start Bitcoin Core\/\fR
.SH DESCRIPTION
Bitcoin Core version v25.2.0rc1
Bitcoin Core version v25.2.0rc2
.SH OPTIONS
.HP
\-?
Expand Down
15 changes: 12 additions & 3 deletions doc/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
25.2rc1 Release Notes
25.2rc2 Release Notes
==================

Bitcoin Core version 25.2rc1 is now available from:
Bitcoin Core version 25.2rc2 is now available from:

<https://bitcoincore.org/bin/bitcoin-core-25.2/test.rc1>
<https://bitcoincore.org/bin/bitcoin-core-25.2/test.rc2>

This release includes various bug fixes and performance
improvements, as well as updated translations.
Expand Down Expand Up @@ -51,6 +51,12 @@ Notable changes
### Wallet

- #29176 wallet: Fix use-after-free in WalletBatch::EraseRecords
- #29510 wallet: `getrawchangeaddress` and `getnewaddress` failures should not affect keypools for descriptor wallets

### P2P and network changes

- #29412 p2p: Don't process mutated blocks
- #29524 p2p: Don't consider blocks mutated if they don't connect to known prev block

Credits
=======
Expand All @@ -60,6 +66,9 @@ Thanks to everyone who directly contributed to this release:
- Martin Zumsande
- Sebastian Falbesoner
- MarcoFalke
- UdjinM6
- dergoegge
- Greg Sanders

As well as to everyone that helped with translations on
[Transifex](https://www.transifex.com/bitcoin/bitcoin/).
12 changes: 11 additions & 1 deletion src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4629,6 +4629,17 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,

LogPrint(BCLog::NET, "received block %s peer=%d\n", pblock->GetHash().ToString(), pfrom.GetId());

const CBlockIndex* prev_block{WITH_LOCK(m_chainman.GetMutex(), return m_chainman.m_blockman.LookupBlockIndex(pblock->hashPrevBlock))};

// Check for possible mutation if it connects to something we know so we can check for DEPLOYMENT_SEGWIT being active
if (prev_block && IsBlockMutated(/*block=*/*pblock,
/*check_witness_root=*/DeploymentActiveAfter(prev_block, m_chainman, Consensus::DEPLOYMENT_SEGWIT))) {
LogPrint(BCLog::NET, "Received mutated block from peer=%d\n", peer->m_id);
Misbehaving(*peer, 100, "mutated block");
WITH_LOCK(cs_main, RemoveBlockRequest(pblock->GetHash(), peer->m_id));
return;
}

bool forceProcessing = false;
const uint256 hash(pblock->GetHash());
bool min_pow_checked = false;
Expand All @@ -4644,7 +4655,6 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
mapBlockSource.emplace(hash, std::make_pair(pfrom.GetId(), true));

// Check work on this block against our anti-dos thresholds.
const CBlockIndex* prev_block = m_chainman.m_blockman.LookupBlockIndex(pblock->hashPrevBlock);
if (prev_block && prev_block->nChainWork + CalculateHeadersWork({pblock->GetBlockHeader()}) >= GetAntiDoSWorkThreshold()) {
min_pow_checked = true;
}
Expand Down
8 changes: 6 additions & 2 deletions src/primitives/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ class CBlock : public CBlockHeader
// network and disk
std::vector<CTransactionRef> vtx;

// memory only
mutable bool fChecked;
// Memory-only flags for caching expensive checks
mutable bool fChecked; // CheckBlock()
mutable bool m_checked_witness_commitment{false}; // CheckWitnessCommitment()
mutable bool m_checked_merkle_root{false}; // CheckMerkleRoot()

CBlock()
{
Expand All @@ -96,6 +98,8 @@ class CBlock : public CBlockHeader
CBlockHeader::SetNull();
vtx.clear();
fChecked = false;
m_checked_witness_commitment = false;
m_checked_merkle_root = false;
}

CBlockHeader GetBlockHeader() const
Expand Down

0 comments on commit d5bad0d

Please sign in to comment.