mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
CI: fix integer underflow bug
This commit is contained in:
parent
73ed5dd541
commit
c6aba4ac06
1 changed files with 4 additions and 1 deletions
|
|
@ -2587,7 +2587,10 @@ bool CChainState::FlushStateToDisk(
|
|||
(*it)->set_stored();
|
||||
}
|
||||
|
||||
int trim_height = pindexBestHeader ? pindexBestHeader->nHeight - node::nMustKeepFullHeaders : 0;
|
||||
int trim_height = 0;
|
||||
if (pindexBestHeader && (uint64_t)pindexBestHeader->nHeight > node::nMustKeepFullHeaders) { // check first, to prevent underflow
|
||||
trim_height = pindexBestHeader->nHeight - node::nMustKeepFullHeaders;
|
||||
}
|
||||
if (node::fTrimHeaders && trim_height > 0 && !ShutdownRequested()) {
|
||||
static int nMinTrimHeight{0};
|
||||
LogPrintf("Flushing block index, trimming headers, setTrimmableBlockIndex.size(): %d\n", setTrimmableBlockIndex.size());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue