Mempool: correctly filter out endorsement without bond

This commit is contained in:
Grégoire Henry 2018-11-23 17:44:29 +01:00 committed by Pierre Boutillier
parent 065d629e7c
commit 8a8912c9bd
No known key found for this signature in database
GPG Key ID: C2F73508B56A193C
3 changed files with 17 additions and 6 deletions

View File

@ -738,7 +738,7 @@ let apply_manager_contents_list ctxt mode baker contents_list =
| `Success ctxt -> Lwt.return (ctxt, results)
let apply_contents_list
(type kind) ctxt chain_id mode pred_block baker
(type kind) ctxt ~partial chain_id mode pred_block baker
(operation : kind operation)
(contents_list : kind contents_list)
: (context * kind contents_result_list) tzresult Lwt.t =
@ -761,7 +761,12 @@ let apply_contents_list
Lwt.return
Tez.(Constants.endorsement_security_deposit ctxt *?
Int64.of_int gap) >>=? fun deposit ->
add_deposit ctxt delegate deposit >>=? fun ctxt ->
begin
if partial then
Delegate.freeze_deposit ctxt delegate deposit
else
add_deposit ctxt delegate deposit
end >>=? fun ctxt ->
Global.get_last_block_priority ctxt >>=? fun block_priority ->
Baking.endorsement_reward ctxt ~block_priority gap >>=? fun reward ->
Delegate.freeze_rewards ctxt delegate reward >>=? fun ctxt ->
@ -912,10 +917,10 @@ let apply_contents_list
apply_manager_contents_list ctxt mode baker op >>= fun (ctxt, result) ->
return (ctxt, result)
let apply_operation ctxt chain_id mode pred_block baker hash operation =
let apply_operation ctxt ~partial chain_id mode pred_block baker hash operation =
let ctxt = Contract.init_origination_nonce ctxt hash in
apply_contents_list
ctxt chain_id mode pred_block baker operation
ctxt ~partial chain_id mode pred_block baker operation
operation.protocol_data.contents >>=? fun (ctxt, result) ->
let ctxt = Gas.set_unlimited ctxt in
let ctxt = Contract.unset_origination_nonce ctxt in

View File

@ -299,7 +299,7 @@ module Scripts = struct
return result
| _ ->
Apply.apply_contents_list
ctxt Chain_id.zero Optimized shell.branch baker operation
ctxt ~partial:true Chain_id.zero Optimized shell.branch baker operation
operation.protocol_data.contents >>=? fun (_ctxt, result) ->
return result

View File

@ -192,7 +192,13 @@ let apply_operation
| Partial_construction { predecessor }
-> predecessor, Signature.Public_key_hash.zero
in
Apply.apply_operation ctxt chain_id Optimized predecessor baker
let partial =
match mode with
| Partial_construction _
| Partial_application _ -> true
| Application _
| Full_construction _ -> false in
Apply.apply_operation ~partial ctxt chain_id Optimized predecessor baker
(Alpha_context.Operation.hash operation)
operation >>=? fun (ctxt, result) ->
let op_count = op_count + 1 in