|
|
@ -1089,7 +1089,7 @@ bool ContextualCheckTransaction( |
|
|
|
// Rules that apply before Sapling:
|
|
|
|
if (!saplingActive) { |
|
|
|
// Size limits
|
|
|
|
BOOST_STATIC_ASSERT(MAX_BLOCK_SIZE > MAX_TX_SIZE_BEFORE_SAPLING); // sanity
|
|
|
|
BOOST_STATIC_ASSERT(MAX_BLOCK_SIZE(chainActive.LastTip()->GetHeight()+1) > MAX_TX_SIZE_BEFORE_SAPLING); // sanity
|
|
|
|
if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) > MAX_TX_SIZE_BEFORE_SAPLING) |
|
|
|
return state.DoS(100, error("ContextualCheckTransaction(): size limits failed"), |
|
|
|
REJECT_INVALID, "bad-txns-oversize"); |
|
|
@ -1311,7 +1311,7 @@ bool CheckTransactionWithoutProofVerification(uint32_t tiptime,const CTransactio |
|
|
|
REJECT_INVALID, "bad-txns-vout-empty"); |
|
|
|
|
|
|
|
// Size limits
|
|
|
|
BOOST_STATIC_ASSERT(MAX_BLOCK_SIZE >= MAX_TX_SIZE_AFTER_SAPLING); // sanity
|
|
|
|
BOOST_STATIC_ASSERT(MAX_BLOCK_SIZE(chainActive.LastTip()->GetHeight()+1) >= MAX_TX_SIZE_AFTER_SAPLING); // sanity
|
|
|
|
BOOST_STATIC_ASSERT(MAX_TX_SIZE_AFTER_SAPLING > MAX_TX_SIZE_BEFORE_SAPLING); // sanity
|
|
|
|
if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) > MAX_TX_SIZE_AFTER_SAPLING) |
|
|
|
return state.DoS(100, error("CheckTransaction(): size limits failed"), |
|
|
@ -4645,7 +4645,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C |
|
|
|
// because we receive the wrong transactions for it.
|
|
|
|
|
|
|
|
// Size limits
|
|
|
|
if (block.vtx.empty() || block.vtx.size() > MAX_BLOCK_SIZE || ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE) |
|
|
|
if (block.vtx.empty() || block.vtx.size() > MAX_BLOCK_SIZE(height) || ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE(height)) |
|
|
|
return state.DoS(100, error("CheckBlock: size limits failed"), |
|
|
|
REJECT_INVALID, "bad-blk-length"); |
|
|
|
|
|
|
@ -5977,7 +5977,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) |
|
|
|
try { |
|
|
|
// This takes over fileIn and calls fclose() on it in the CBufferedFile destructor
|
|
|
|
//CBufferedFile blkdat(fileIn, 2*MAX_BLOCK_SIZE, MAX_BLOCK_SIZE+8, SER_DISK, CLIENT_VERSION);
|
|
|
|
CBufferedFile blkdat(fileIn, 32*MAX_BLOCK_SIZE, MAX_BLOCK_SIZE+8, SER_DISK, CLIENT_VERSION); |
|
|
|
CBufferedFile blkdat(fileIn, 32*MAX_BLOCK_SIZE(10000000), MAX_BLOCK_SIZE(10000000)+8, SER_DISK, CLIENT_VERSION); |
|
|
|
uint64_t nRewind = blkdat.GetPos(); |
|
|
|
while (!blkdat.eof()) { |
|
|
|
boost::this_thread::interruption_point(); |
|
|
@ -5996,7 +5996,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) |
|
|
|
continue; |
|
|
|
// read size
|
|
|
|
blkdat >> nSize; |
|
|
|
if (nSize < 80 || nSize > MAX_BLOCK_SIZE) |
|
|
|
if (nSize < 80 || nSize > MAX_BLOCK_SIZE(10000000)) |
|
|
|
continue; |
|
|
|
} catch (const std::exception&) { |
|
|
|
// no valid block header found; don't complain
|
|
|
|