From 958422a7c4898e1edb9a514e84eaa2d5664ef36f Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Mon, 19 Jan 2026 12:07:00 +0000 Subject: [PATCH] node/routing: remove error scenario from Database::prune A call to `Database::prune` with no limit could result in a domain-defined overflow error. If the limit is not provided, then it uses `i64::MAX`. It is reasonable to expect that if the `usize` provided is more than `i64::MAX` then the `i64::MAX` value is acceptable to use for pruning. --- crates/radicle/src/node/routing.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/radicle/src/node/routing.rs b/crates/radicle/src/node/routing.rs index 466010f9..2443e4b2 100644 --- a/crates/radicle/src/node/routing.rs +++ b/crates/radicle/src/node/routing.rs @@ -222,10 +222,8 @@ impl Store for Database { ignore: &NodeId, ) -> Result { let limit: i64 = limit - .unwrap_or(i64::MAX as usize) - .try_into() - .map_err(|_| Error::UnitOverflow)?; - + .and_then(|limit| i64::try_from(limit).ok()) + .unwrap_or(i64::MAX); let mut stmt = self.db.prepare( "DELETE FROM routing WHERE node <> ?1 AND rowid IN