Merge 108462139b into merged_master (Bitcoin PR bitcoin/bitcoin#28438)

This commit is contained in:
Byron Hambly 2025-11-06 13:08:59 +02:00
commit 8cf8bd5564
No known key found for this signature in database
GPG key ID: DE8F6EA20A661697
85 changed files with 444 additions and 489 deletions

View file

@ -755,7 +755,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
}
// Transactions smaller than 65 non-witness bytes are not relayed to mitigate CVE-2017-12842.
if (::GetSerializeSize(tx, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) < MIN_STANDARD_TX_NONWITNESS_SIZE)
if (::GetSerializeSize(TX_NO_WITNESS(tx)) < MIN_STANDARD_TX_NONWITNESS_SIZE)
return state.Invalid(TxValidationResult::TX_NOT_STANDARD, "tx-size-small");
// Only accept nLockTime-using transactions that can be mined in the next
@ -4025,7 +4025,7 @@ bool CheckBlock(const CBlock& block, BlockValidationState& state, const Consensu
// checks that use witness data may be performed here.
// Size limits
if (block.vtx.empty() || block.vtx.size() * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT || ::GetSerializeSize(block, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT)
if (block.vtx.empty() || block.vtx.size() * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT || ::GetSerializeSize(TX_NO_WITNESS(block)) * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT)
return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-blk-length", "size limits failed");
// First transaction must be coinbase, the rest must not be
@ -5173,7 +5173,7 @@ void ChainstateManager::LoadExternalBlockFile(
dbp->nPos = nBlockPos;
blkdat.SetLimit(nBlockPos + nSize);
CBlockHeader header;
blkdat >> header;
blkdat >> TX_WITH_WITNESS(header);
const uint256 hash{header.GetHash()};
// Skip the rest of this block (this may read from disk into memory); position to the marker before the
// next block, but it's still possible to rewind to the start of the current block (without a disk read).
@ -5200,7 +5200,7 @@ void ChainstateManager::LoadExternalBlockFile(
// This block can be processed immediately; rewind to its start, read and deserialize it.
blkdat.SetPos(nBlockPos);
pblock = std::make_shared<CBlock>();
blkdat >> *pblock;
blkdat >> TX_WITH_WITNESS(*pblock);
nRewind = blkdat.GetPos();
BlockValidationState state;