Ignore client-specified timestamp in favor of server generated one

This commit is contained in:
nielsandriesse 2021-05-31 10:39:11 +10:00
parent 27c345f662
commit 297d024965
1 changed files with 2 additions and 1 deletions

View File

@ -474,13 +474,14 @@ pub fn insert_message(
let mut conn = pool.get().map_err(|_| Error::DatabaseFailedInternally)?;
let tx = conn.transaction().map_err(|_| Error::DatabaseFailedInternally)?;
// Insert the message
let timestamp = chrono::Utc::now().timestamp_millis();
let stmt = format!(
"INSERT INTO {} (public_key, timestamp, data, signature, is_deleted) VALUES (?1, ?2, ?3, ?4, ?5)",
storage::MESSAGES_TABLE
);
match tx.execute(
&stmt,
params![&requesting_public_key, message.timestamp, message.data, message.signature, 0],
params![&requesting_public_key, timestamp, message.data, message.signature, 0],
) {
Ok(_) => (),
Err(e) => {