mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-21 10:30:41 +08:00
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.
This commit is contained in:
@@ -222,10 +222,8 @@ impl Store for Database {
|
||||
ignore: &NodeId,
|
||||
) -> Result<usize, Error> {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user