On Fri, Mar 12, 2021 at 4:58 AM Thomas Munro <thomas.mu...@gmail.com> wrote: > > While rebasing CF #2933 (which drops the _cached stuff and makes this > optimisation always available, woo), I happened to notice that we're > summing the size of many relations and forks into a variable > nBlocksToInvalidate of type BlockNumber. That could overflow. >
I also think so. I think we have two ways to address that: (a) check immediately after each time we add blocks to nBlocksToInvalidate to see if it crosses the threshold value BUF_DROP_FULL_SCAN_THRESHOLD and if so, then just break the loop; (b) change the variable type to uint64. Any better ideas? -- With Regards, Amit Kapila.