mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
Merge bitcoin/bitcoin#23795: refactor: Remove implicit-integer-sign-change suppressions in validation
fadd73037e
refactor: Remove implicit-integer-sign-change suppressions in validation.cpp (MarcoFalke) Pull request description: A file-wide suppression is problematic because it will wave through future violations, potentially bugs. Fix that by using per-statement casts. ACKs for top commit: shaavan: ACKfadd73037e
theStack: Code-review ACKfadd73037e
Tree-SHA512: a8a05613be35382b92d7970f958a4e8f4332432056eaa9d72f6719495134b93aaaeea692899d9035654d0e0cf56bcd759671eeeacfd0535582c0ea048ab58a56
This commit is contained in:
commit
8b5a4de904
2 changed files with 5 additions and 6 deletions
|
@ -2182,7 +2182,7 @@ CoinsCacheSizeState CChainState::GetCoinsCacheSizeState(
|
||||||
const int64_t nMempoolUsage = m_mempool ? m_mempool->DynamicMemoryUsage() : 0;
|
const int64_t nMempoolUsage = m_mempool ? m_mempool->DynamicMemoryUsage() : 0;
|
||||||
int64_t cacheSize = CoinsTip().DynamicMemoryUsage();
|
int64_t cacheSize = CoinsTip().DynamicMemoryUsage();
|
||||||
int64_t nTotalSpace =
|
int64_t nTotalSpace =
|
||||||
max_coins_cache_size_bytes + std::max<int64_t>(max_mempool_size_bytes - nMempoolUsage, 0);
|
max_coins_cache_size_bytes + std::max<int64_t>(int64_t(max_mempool_size_bytes) - nMempoolUsage, 0);
|
||||||
|
|
||||||
//! No need to periodic flush if at least this much space still available.
|
//! No need to periodic flush if at least this much space still available.
|
||||||
static constexpr int64_t MAX_BLOCK_COINSDB_USAGE_BYTES = 10 * 1024 * 1024; // 10MB
|
static constexpr int64_t MAX_BLOCK_COINSDB_USAGE_BYTES = 10 * 1024 * 1024; // 10MB
|
||||||
|
@ -3620,7 +3620,7 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, Block
|
||||||
// blocks which are too close in height to the tip. Apply this test
|
// blocks which are too close in height to the tip. Apply this test
|
||||||
// regardless of whether pruning is enabled; it should generally be safe to
|
// regardless of whether pruning is enabled; it should generally be safe to
|
||||||
// not process unrequested blocks.
|
// not process unrequested blocks.
|
||||||
bool fTooFarAhead = (pindex->nHeight > int(m_chain.Height() + MIN_BLOCKS_TO_KEEP));
|
bool fTooFarAhead{pindex->nHeight > m_chain.Height() + int(MIN_BLOCKS_TO_KEEP)};
|
||||||
|
|
||||||
// TODO: Decouple this function from the block download logic by removing fRequested
|
// TODO: Decouple this function from the block download logic by removing fRequested
|
||||||
// This requires some new chain data structure to efficiently look up if a
|
// This requires some new chain data structure to efficiently look up if a
|
||||||
|
@ -3842,7 +3842,7 @@ void BlockManager::FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPr
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int nLastBlockWeCanPrune = std::min(prune_height, chain_tip_height - static_cast<int>(MIN_BLOCKS_TO_KEEP));
|
unsigned int nLastBlockWeCanPrune{(unsigned)std::min(prune_height, chain_tip_height - static_cast<int>(MIN_BLOCKS_TO_KEEP))};
|
||||||
uint64_t nCurrentUsage = CalculateCurrentUsage();
|
uint64_t nCurrentUsage = CalculateCurrentUsage();
|
||||||
// We don't check to prune until after we've allocated new space for files
|
// We don't check to prune until after we've allocated new space for files
|
||||||
// So we should leave a buffer under our target to account for another allocation
|
// So we should leave a buffer under our target to account for another allocation
|
||||||
|
@ -4442,8 +4442,8 @@ void CChainState::LoadExternalBlockFile(FILE* fileIn, FlatFilePos* dbp)
|
||||||
try {
|
try {
|
||||||
// locate a header
|
// locate a header
|
||||||
unsigned char buf[CMessageHeader::MESSAGE_START_SIZE];
|
unsigned char buf[CMessageHeader::MESSAGE_START_SIZE];
|
||||||
blkdat.FindByte(m_params.MessageStart()[0]);
|
blkdat.FindByte(char(m_params.MessageStart()[0]));
|
||||||
nRewind = blkdat.GetPos()+1;
|
nRewind = blkdat.GetPos() + 1;
|
||||||
blkdat >> buf;
|
blkdat >> buf;
|
||||||
if (memcmp(buf, m_params.MessageStart(), CMessageHeader::MESSAGE_START_SIZE)) {
|
if (memcmp(buf, m_params.MessageStart(), CMessageHeader::MESSAGE_START_SIZE)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -77,7 +77,6 @@ implicit-integer-sign-change:test/skiplist_tests.cpp
|
||||||
implicit-integer-sign-change:test/streams_tests.cpp
|
implicit-integer-sign-change:test/streams_tests.cpp
|
||||||
implicit-integer-sign-change:test/transaction_tests.cpp
|
implicit-integer-sign-change:test/transaction_tests.cpp
|
||||||
implicit-integer-sign-change:txmempool.cpp
|
implicit-integer-sign-change:txmempool.cpp
|
||||||
implicit-integer-sign-change:validation.cpp
|
|
||||||
implicit-integer-sign-change:zmq/zmqpublishnotifier.cpp
|
implicit-integer-sign-change:zmq/zmqpublishnotifier.cpp
|
||||||
implicit-signed-integer-truncation,implicit-integer-sign-change:chain.h
|
implicit-signed-integer-truncation,implicit-integer-sign-change:chain.h
|
||||||
implicit-signed-integer-truncation,implicit-integer-sign-change:test/skiplist_tests.cpp
|
implicit-signed-integer-truncation,implicit-integer-sign-change:test/skiplist_tests.cpp
|
||||||
|
|
Loading…
Add table
Reference in a new issue