]> git.bitcoin.ninja Git - rapid-gossip-sync-server/commit
Fix multiplication overflow bug.
authorArik Sosman <git@arik.io>
Mon, 28 Aug 2023 16:07:19 +0000 (09:07 -0700)
committerArik Sosman <git@arik.io>
Mon, 28 Aug 2023 16:35:29 +0000 (09:35 -0700)
commit801c8026ba79808d8e5d5400ad41f4ca546ecd59
tree394520415a1b3b90e5beb91253f567af61d272d4
parent3fccdff87744f2fccd5280e24a49172b6a877a21
Fix multiplication overflow bug.

The `snapshot_sync_day_factors` array is sorted
ascendingly, so find() will return on the first
iteration that is at least equal to the requested
interval.

However, the last value in the array is u64::max,
which means that multiplying it with DAY_SECONDS
will overflow. To avoid that, we use saturating_mul.
src/snapshot.rs