radicle: Fix bug in node.db query

This commit is contained in:
cloudhead 2023-12-19 13:26:17 +01:00
parent 48dedc6e7e
commit 59f506dbb5
No known key found for this signature in database
1 changed files with 5 additions and 1 deletions

View File

@ -277,7 +277,7 @@ impl Store for Database {
stmt.next()?;
// Reduce penalty by half on successful connect.
db.prepare("UPDATE `nodes` SET penalty = penalty / 2 WHERE node = ?1")?;
let mut stmt = db.prepare("UPDATE `nodes` SET penalty = penalty / 2 WHERE id = ?1")?;
stmt.bind((1, nid))?;
stmt.next()?;
@ -665,5 +665,9 @@ mod test {
cache.disconnected(&alice, &addr, Severity::High).unwrap();
let node = cache.get(&alice).unwrap().unwrap();
assert_eq!(node.penalty, Penalty(9));
cache.connected(&alice, &addr, timestamp + 1).unwrap();
let node = cache.get(&alice).unwrap().unwrap();
assert_eq!(node.penalty, Penalty(4));
}
}