mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 15:19:07 +01:00
Use ParamsWrapper for witness serialization
This commit is contained in:
@@ -722,7 +722,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
|
||||
@@ -3685,7 +3685,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
|
||||
@@ -4724,7 +4724,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;
|
||||
|
||||
Reference in New Issue
Block a user