Skip to content

Commit 134aa9e

Browse files
Merge pull request #415 from permaweb/revert-412-temp/separated-messages
Revert "temp: Store messages primarily by their signed ID"
2 parents a05dcf4 + 9addc1c commit 134aa9e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/hb_cache.erl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,15 @@ do_write_message(List, Store, Opts) when is_list(List) ->
234234
do_write_message(Msg, Store, Opts) when is_map(Msg) ->
235235
?event(debug_cache, {writing_message, Msg}),
236236
% Calculate the IDs of the message.
237-
CommittedID = hb_message:id(Msg, signed, Opts#{ linkify_mode => discard }),
238-
AltIDs = calculate_all_ids(Msg, Opts) -- [CommittedID],
237+
UncommittedID = hb_message:id(Msg, none, Opts#{ linkify_mode => discard }),
238+
AltIDs = calculate_all_ids(Msg, Opts) -- [UncommittedID],
239239
MsgHashpathAlg = hb_path:hashpath_alg(Msg, Opts),
240-
?event(debug_cache, {writing_message, {id, CommittedID}, {alt_ids, AltIDs}, {original, Msg}}),
240+
?event(debug_cache, {writing_message, {id, UncommittedID}, {alt_ids, AltIDs}, {original, Msg}}),
241241
% Write all of the keys of the message into the store.
242-
hb_store:make_group(Store, CommittedID),
242+
hb_store:make_group(Store, UncommittedID),
243243
maps:map(
244244
fun(Key, Value) ->
245-
write_key(CommittedID, Key, MsgHashpathAlg, Value, Store, Opts)
245+
write_key(UncommittedID, Key, MsgHashpathAlg, Value, Store, Opts)
246246
end,
247247
maps:without([<<"priv">>], Msg)
248248
),
@@ -252,14 +252,14 @@ do_write_message(Msg, Store, Opts) when is_map(Msg) ->
252252
fun(AltID) ->
253253
?event(debug_cache,
254254
{linking_commitment,
255-
{committed_id, CommittedID},
256-
{alt_id, AltID}
255+
{uncommitted_id, UncommittedID},
256+
{committed_id, AltID}
257257
}),
258-
hb_store:make_link(Store, CommittedID, AltID)
258+
hb_store:make_link(Store, UncommittedID, AltID)
259259
end,
260260
AltIDs
261261
),
262-
{ok, CommittedID}.
262+
{ok, UncommittedID}.
263263

264264
%% @doc Write a single key for a message into the store.
265265
write_key(Base, <<"commitments">>, _HPAlg, RawCommitments, Store, Opts) ->

0 commit comments

Comments
 (0)