0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-13 21:41:06 +01:00

ircd:Ⓜ️ Branch to remove hashes/signatures if defined when hashing.

This commit is contained in:
Jason Volk 2018-03-21 00:22:20 -07:00
parent 615ccdc426
commit d75e8d50b9

View file

@ -471,7 +471,21 @@ ircd::sha256::buf
ircd::m::event::hash(const m::event &event) ircd::m::event::hash(const m::event &event)
{ {
thread_local char buf[64_KiB]; thread_local char buf[64_KiB];
const string_view preimage string_view preimage;
//TODO: tuple::keys::selection
if(defined(json::get<"signatures"_>(event)) ||
defined(json::get<"hashes"_>(event)))
{
m::event event_{event};
json::get<"signatures"_>(event_) = {};
json::get<"hashes"_>(event_) = {};
preimage =
{
stringify(buf, event_)
};
}
else preimage =
{ {
stringify(buf, event) stringify(buf, event)
}; };