Skip to content

Commit

Permalink
- Flipped rewrite order.
Browse files Browse the repository at this point in the history
- Improved logging messages.
  • Loading branch information
samcamwilliams committed Oct 8, 2018
1 parent bef1ad6 commit e7cfe56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/ar_cleanup.erl
Expand Up @@ -53,18 +53,18 @@ remove_invalid_blocks(HashList) ->
%% In the case of upgrading a node from 1.1 to 1.5, this dramatically reduces
%% the size of the weave on disk (and on the wire).
rewrite() ->
rewrite(ar_node:get_hash_list(whereis(http_entrypoint_node))).
rewrite(lists:reverse(ar_node:get_hash_list(whereis(http_entrypoint_node)))).
rewrite(BHL) -> rewrite(BHL, BHL).
rewrite([], _BHL) -> [];
rewrite([H|Rest], BHL) ->
try ar_storage:read_block(H, BHL) of
B when ?IS_BLOCK(B) ->
ar_storage:write_block(B),
ar:report([{compacted_block, ar_util:encode(H)}]);
ar:report([{rewrote_block, ar_util:encode(H)}]);
unavailable ->
do_nothing
catch _:_ ->
ar:report([{error_compacting_block, ar_util:encode(H)}])
ar:report([{error_rewriting_block, ar_util:encode(H)}])
end,
rewrite(Rest, BHL).

Expand Down
8 changes: 7 additions & 1 deletion src/ar_fork_recovery.erl
Expand Up @@ -187,7 +187,13 @@ do_fork_recover(S = #state {
}
);
false ->
ar:report(not_updating_target_block),
ar:report(
[
not_updating_target_block,
{ignored_block, ar_util:encode(Block#block.indep_hash)},
{height, Block#block.height}
]
),
server(S)
end;
apply_next_block ->
Expand Down

0 comments on commit e7cfe56

Please sign in to comment.