From 59f506dbb5591d3fe68e638038495730c455d72a Mon Sep 17 00:00:00 2001 From: cloudhead Date: Tue, 19 Dec 2023 13:26:17 +0100 Subject: [PATCH] radicle: Fix bug in node.db query --- radicle/src/node/address/store.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/radicle/src/node/address/store.rs b/radicle/src/node/address/store.rs index d9de9a89..018f5629 100644 --- a/radicle/src/node/address/store.rs +++ b/radicle/src/node/address/store.rs @@ -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)); } }