radicle: Fix bug in node.db query
This commit is contained in:
parent
48dedc6e7e
commit
59f506dbb5
|
|
@ -277,7 +277,7 @@ impl Store for Database {
|
||||||
stmt.next()?;
|
stmt.next()?;
|
||||||
|
|
||||||
// Reduce penalty by half on successful connect.
|
// 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.bind((1, nid))?;
|
||||||
stmt.next()?;
|
stmt.next()?;
|
||||||
|
|
@ -665,5 +665,9 @@ mod test {
|
||||||
cache.disconnected(&alice, &addr, Severity::High).unwrap();
|
cache.disconnected(&alice, &addr, Severity::High).unwrap();
|
||||||
let node = cache.get(&alice).unwrap().unwrap();
|
let node = cache.get(&alice).unwrap().unwrap();
|
||||||
assert_eq!(node.penalty, Penalty(9));
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue