Baker: Fix nonces file cleanup
If it fails to fetch the metadata of a block it has a nonce for, it drops the nonce.
This commit is contained in:
parent
8b839c9ad9
commit
ede71b9e83
@ -950,12 +950,14 @@ let filter_outdated_nonces
|
|||||||
Block_hash.Map.fold
|
Block_hash.Map.fold
|
||||||
begin fun hash nonce acc ->
|
begin fun hash nonce acc ->
|
||||||
acc >>=? fun acc ->
|
acc >>=? fun acc ->
|
||||||
Alpha_block_services.metadata cctxt ~chain ~block:(`Hash (hash, 0)) () >>=?
|
Alpha_block_services.metadata cctxt ~chain ~block:(`Hash (hash, 0)) () >>=
|
||||||
fun { protocol_data = { level = { Level.cycle } } } ->
|
function
|
||||||
if is_older_than_5_cycles cycle then
|
| Result.Error _ -> return (Block_hash.Map.add hash nonce acc)
|
||||||
return acc
|
| Result.Ok { protocol_data = { level = { Level.cycle } } } ->
|
||||||
else
|
if is_older_than_5_cycles cycle then
|
||||||
return (Block_hash.Map.add hash nonce acc)
|
return acc
|
||||||
|
else
|
||||||
|
return (Block_hash.Map.add hash nonce acc)
|
||||||
end
|
end
|
||||||
nonces
|
nonces
|
||||||
(return Block_hash.Map.empty) >>=? fun new_nonces ->
|
(return Block_hash.Map.empty) >>=? fun new_nonces ->
|
||||||
|
Loading…
Reference in New Issue
Block a user