Alpha: burn only rewards and fees when baker do not reveal seeds

We only forfeit the bond in case of double-baking.
This commit is contained in:
Grégoire Henry 2018-04-19 09:59:35 +02:00 committed by Benjamin Canou
parent c696502131
commit 3e6633bacc
2 changed files with 4 additions and 5 deletions

View File

@ -667,7 +667,7 @@ let begin_application ctxt block_header pred_timestamp =
let ctxt = Fitness.increase ctxt in let ctxt = Fitness.increase ctxt in
return (ctxt, delegate_pk, deposit) return (ctxt, delegate_pk, deposit)
let finalize_application ctxt protocol_data delegate deposit = let finalize_application ctxt protocol_data delegate =
let block_reward = Constants.block_reward ctxt in let block_reward = Constants.block_reward ctxt in
add_rewards ctxt block_reward >>=? fun ctxt -> add_rewards ctxt block_reward >>=? fun ctxt ->
(* end of level (from this point nothing should fail) *) (* end of level (from this point nothing should fail) *)
@ -680,7 +680,7 @@ let finalize_application ctxt protocol_data delegate deposit =
| None -> return ctxt | None -> return ctxt
| Some nonce_hash -> | Some nonce_hash ->
Nonce.record_hash ctxt Nonce.record_hash ctxt
{ nonce_hash ; delegate ; deposit ; rewards ; fees } { nonce_hash ; delegate ; deposit = Tez.zero ; rewards ; fees }
end >>=? fun ctxt -> end >>=? fun ctxt ->
(* end of cycle *) (* end of cycle *)
may_snapshot_roll ctxt >>=? fun ctxt -> may_snapshot_roll ctxt >>=? fun ctxt ->

View File

@ -120,7 +120,7 @@ let apply_operation ({ mode ; ctxt ; op_count ; _ } as data) operation =
let op_count = op_count + 1 in let op_count = op_count + 1 in
return { data with ctxt ; op_count } return { data with ctxt ; op_count }
let finalize_block { mode ; ctxt ; op_count ; deposit } = let finalize_block { mode ; ctxt ; op_count ; deposit = _ } =
match mode with match mode with
| Partial_construction _ -> | Partial_construction _ ->
let ctxt = Alpha_context.finalize ctxt in let ctxt = Alpha_context.finalize ctxt in
@ -128,8 +128,7 @@ let finalize_block { mode ; ctxt ; op_count ; deposit } =
| Application | Application
{ baker ; block_header = { protocol_data ; _ } } { baker ; block_header = { protocol_data ; _ } }
| Full_construction { protocol_data ; baker ; _ } -> | Full_construction { protocol_data ; baker ; _ } ->
Apply.finalize_application Apply.finalize_application ctxt protocol_data baker >>=? fun ctxt ->
ctxt protocol_data baker deposit >>=? fun ctxt ->
let { level ; _ } : Alpha_context.Level.t = let { level ; _ } : Alpha_context.Level.t =
Alpha_context. Level.current ctxt in Alpha_context. Level.current ctxt in
let priority = protocol_data.priority in let priority = protocol_data.priority in