Alpha: include fees from failed operations in receipts
This commit is contained in:
parent
13fb40a4c9
commit
67f95ff156
@ -540,21 +540,27 @@ let apply_manager_contents
|
|||||||
|
|
||||||
let rec mark_skipped
|
let rec mark_skipped
|
||||||
: type kind.
|
: type kind.
|
||||||
kind Kind.manager contents_list ->
|
Signature.Public_key_hash.t -> Level.t -> kind Kind.manager contents_list ->
|
||||||
kind Kind.manager contents_result_list = function
|
kind Kind.manager contents_result_list = fun baker level -> function
|
||||||
| Single (Manager_operation op) ->
|
| Single (Manager_operation ({ source ; fee } as op)) ->
|
||||||
Single_result
|
Single_result
|
||||||
(Manager_operation_result
|
(Manager_operation_result
|
||||||
{ balance_updates = [] ;
|
{ balance_updates =
|
||||||
|
cleanup_balance_updates
|
||||||
|
[ Contract source, Debited fee ;
|
||||||
|
Rewards (baker, level.cycle), Credited fee ] ;
|
||||||
operation_result = Skipped (manager_kind op.operation) ;
|
operation_result = Skipped (manager_kind op.operation) ;
|
||||||
internal_operation_results = [] })
|
internal_operation_results = [] })
|
||||||
| Cons (Manager_operation op, rest) ->
|
| Cons (Manager_operation ({ source ; fee } as op), rest) ->
|
||||||
Cons_result
|
Cons_result
|
||||||
(Manager_operation_result {
|
(Manager_operation_result {
|
||||||
balance_updates = [] ;
|
balance_updates =
|
||||||
|
cleanup_balance_updates
|
||||||
|
[ Contract source, Debited fee ;
|
||||||
|
Rewards (baker, level.cycle), Credited fee ] ;
|
||||||
operation_result = Skipped (manager_kind op.operation) ;
|
operation_result = Skipped (manager_kind op.operation) ;
|
||||||
internal_operation_results = [] },
|
internal_operation_results = [] },
|
||||||
mark_skipped rest)
|
mark_skipped baker level rest)
|
||||||
|
|
||||||
let rec precheck_manager_contents_list
|
let rec precheck_manager_contents_list
|
||||||
: type kind.
|
: type kind.
|
||||||
@ -574,13 +580,17 @@ let rec apply_manager_contents_list
|
|||||||
public_key_hash -> kind Kind.manager contents_list ->
|
public_key_hash -> kind Kind.manager contents_list ->
|
||||||
(context * kind Kind.manager contents_result_list) Lwt.t =
|
(context * kind Kind.manager contents_result_list) Lwt.t =
|
||||||
fun ctxt mode baker contents_list ->
|
fun ctxt mode baker contents_list ->
|
||||||
|
let level = Level.current ctxt in
|
||||||
match contents_list with
|
match contents_list with
|
||||||
| Single (Manager_operation { operation ; _ } as op) -> begin
|
| Single (Manager_operation { operation ; source ; fee ; _ } as op) -> begin
|
||||||
apply_manager_contents ctxt mode baker op >>= function
|
apply_manager_contents ctxt mode baker op >>= function
|
||||||
| Error errors ->
|
| Error errors ->
|
||||||
let result =
|
let result =
|
||||||
Manager_operation_result {
|
Manager_operation_result {
|
||||||
balance_updates = [] ;
|
balance_updates =
|
||||||
|
cleanup_balance_updates
|
||||||
|
[ Contract source, Debited fee ;
|
||||||
|
Rewards (baker, level.cycle), Credited fee ] ;
|
||||||
operation_result = Failed (manager_kind operation, errors) ;
|
operation_result = Failed (manager_kind operation, errors) ;
|
||||||
internal_operation_results = []
|
internal_operation_results = []
|
||||||
} in
|
} in
|
||||||
@ -593,16 +603,19 @@ let rec apply_manager_contents_list
|
|||||||
{ operation_result = (Skipped _ | Failed _) ; _ } as result)) ->
|
{ operation_result = (Skipped _ | Failed _) ; _ } as result)) ->
|
||||||
Lwt.return (ctxt, Single_result (result))
|
Lwt.return (ctxt, Single_result (result))
|
||||||
end
|
end
|
||||||
| Cons (Manager_operation { operation ; _ } as op, rest) ->
|
| Cons (Manager_operation { operation ; source ; fee ; _ } as op, rest) ->
|
||||||
apply_manager_contents ctxt mode baker op >>= function
|
apply_manager_contents ctxt mode baker op >>= function
|
||||||
| Error errors ->
|
| Error errors ->
|
||||||
let result =
|
let result =
|
||||||
Manager_operation_result {
|
Manager_operation_result {
|
||||||
balance_updates = [] ;
|
balance_updates =
|
||||||
|
cleanup_balance_updates
|
||||||
|
[ Contract source, Debited fee ;
|
||||||
|
Rewards (baker, level.cycle), Credited fee ] ;
|
||||||
operation_result = Failed (manager_kind operation, errors) ;
|
operation_result = Failed (manager_kind operation, errors) ;
|
||||||
internal_operation_results = []
|
internal_operation_results = []
|
||||||
} in
|
} in
|
||||||
Lwt.return (ctxt, Cons_result (result, mark_skipped rest))
|
Lwt.return (ctxt, Cons_result (result, mark_skipped baker level rest))
|
||||||
| Ok (ctxt, (Manager_operation_result
|
| Ok (ctxt, (Manager_operation_result
|
||||||
{ operation_result = Applied _ ; _ } as result)) ->
|
{ operation_result = Applied _ ; _ } as result)) ->
|
||||||
apply_manager_contents_list ctxt mode baker rest >>= fun (ctxt, results) ->
|
apply_manager_contents_list ctxt mode baker rest >>= fun (ctxt, results) ->
|
||||||
@ -610,7 +623,7 @@ let rec apply_manager_contents_list
|
|||||||
| Ok (ctxt,
|
| Ok (ctxt,
|
||||||
(Manager_operation_result
|
(Manager_operation_result
|
||||||
{ operation_result = (Skipped _ | Failed _) ; _ } as result)) ->
|
{ operation_result = (Skipped _ | Failed _) ; _ } as result)) ->
|
||||||
Lwt.return (ctxt, Cons_result (result, mark_skipped rest))
|
Lwt.return (ctxt, Cons_result (result, mark_skipped baker level rest))
|
||||||
|
|
||||||
let apply_contents_list
|
let apply_contents_list
|
||||||
(type kind) ctxt mode pred_block baker
|
(type kind) ctxt mode pred_block baker
|
||||||
|
Loading…
Reference in New Issue
Block a user