Log first part of RelayMessage when it cannot be deserialized from JSON, so the event.id can be chased down and the issue figured out.

As an example, I found someone had 'p' tags with npub values in them.
This commit is contained in:
Mike Dilger 2023-01-10 17:53:36 +13:00
parent 8f42829cb4
commit 21b725f11d

View File

@ -9,7 +9,16 @@ impl Minion {
// TODO: pull out the raw event without any deserialization to be sure we don't mangle // TODO: pull out the raw event without any deserialization to be sure we don't mangle
// it. // it.
let relay_message: RelayMessage = serde_json::from_str(&ws_message)?; let relay_message: RelayMessage = match serde_json::from_str(&ws_message) {
Ok(rm) => rm,
Err(e) => {
tracing::error!(
"RELAY MESSAGE NOT DESERIALIZING: starts with \"{}\"",
&ws_message.chars().take(300).collect::<String>()
);
return Err(e.into());
}
};
let mut maxtime = Unixtime::now()?; let mut maxtime = Unixtime::now()?;
maxtime.0 += 60 * 15; // 15 minutes into the future maxtime.0 += 60 * 15; // 15 minutes into the future