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:
parent
95b3d10961
commit
958422a7c4
|
|
@ -222,10 +222,8 @@ impl Store for Database {
|
||||||
ignore: &NodeId,
|
ignore: &NodeId,
|
||||||
) -> Result<usize, Error> {
|
) -> Result<usize, Error> {
|
||||||
let limit: i64 = limit
|
let limit: i64 = limit
|
||||||
.unwrap_or(i64::MAX as usize)
|
.and_then(|limit| i64::try_from(limit).ok())
|
||||||
.try_into()
|
.unwrap_or(i64::MAX);
|
||||||
.map_err(|_| Error::UnitOverflow)?;
|
|
||||||
|
|
||||||
let mut stmt = self.db.prepare(
|
let mut stmt = self.db.prepare(
|
||||||
"DELETE FROM routing
|
"DELETE FROM routing
|
||||||
WHERE node <> ?1 AND rowid IN
|
WHERE node <> ?1 AND rowid IN
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue