Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
radicle: Fix bug in node.db query
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed Dec 19, 2023
1 parent 48dedc6 commit 59f506d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion radicle/src/node/address/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?;
Expand Down Expand Up @@ -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));
}
}

0 comments on commit 59f506d

Please sign in to comment.