fix(NIP-09): correct WHERE clause for event deletion

This commit is contained in:
Greg Heartsfield 2022-05-10 16:50:52 -05:00
parent 4ad483090e
commit 9ed3391b46

View File

@ -344,7 +344,7 @@ pub fn write_event(conn: &mut PooledConnection, e: &Event) -> Result<usize> {
.filter_map(|x| hex::decode(x).ok()) .filter_map(|x| hex::decode(x).ok())
.for_each(|x| params.push(Box::new(x))); .for_each(|x| params.push(Box::new(x)));
let query = format!( let query = format!(
"UPDATE event SET hidden=TRUE WHERE author=?, event_hash IN ({})", "UPDATE event SET hidden=TRUE WHERE author=? AND event_hash IN ({})",
repeat_vars(params.len() - 1) repeat_vars(params.len() - 1)
); );
let mut stmt = tx.prepare(&query)?; let mut stmt = tx.prepare(&query)?;