Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

verify ledger poc blockhash eq the block blockhash #1841

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/poc/miner_poc_mgr.erl
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,15 @@ process_block_pocs(
maps:from_list(blockchain_ledger_v1:snapshot_vars(Ledger))),
%% confirm the POC exists on the ledger, if not then drop the POC
case blockchain_ledger_v1:find_public_poc(OnionKeyHash, Ledger) of
{ok, _} ->
spawn(fun() -> initialize_poc(BlockHash, BlockHeight, Keys, Vars, Ledger, State) end);
{ok, PubPoC} ->
PoCBlockHash = blockchain_ledger_poc_v3:block_hash(PubPoC),
case BlockHash =:= PoCBlockHash of
true ->
spawn(fun() -> initialize_poc(BlockHash, BlockHeight, Keys, Vars, Ledger, State) end);
false ->
lager:warning("found a local poc key but mismatched blockhash: ~p ~p", [BlockHash, PoCBlockHash]),
ok
end;
_ ->
lager:warning("found a local poc key but public data missing, onionkeyhash: ~p", [OnionKeyHash]),
ok
Expand Down