Client: fix display of failed transactions

This commit is contained in:
Benjamin Canou 2018-06-26 19:06:21 +02:00
parent 878c63391b
commit 6ad461f9e2
2 changed files with 13 additions and 4 deletions

View File

@ -320,6 +320,15 @@ let may_patch_limits
match may_need_patching contents with match may_need_patching contents with
| Some contents -> | Some contents ->
simulate cctxt ~chain ~block ?branch contents >>=? fun (_, _, result) -> simulate cctxt ~chain ~block ?branch contents >>=? fun (_, _, result) ->
begin match detect_script_failure result with
| Ok () -> return ()
| Error _ ->
cctxt#message
"@[<v 2>This simulation failed:@,%a@]"
Operation_result.pp_operation_result
(contents, result.contents) >>= fun () ->
return ()
end >>=? fun () ->
let res = pack_contents_list contents result.contents in let res = pack_contents_list contents result.contents in
patch_list res patch_list res
| None -> return contents | None -> return contents

View File

@ -221,14 +221,14 @@ let pp_manager_operation_contents_and_result ppf
"This revelation was successfully applied" "This revelation was successfully applied"
| Backtracked (Reveal_result, _) -> | Backtracked (Reveal_result, _) ->
Format.fprintf ppf Format.fprintf ppf
"@<v 0>This revelation was BACKTRACKED,@,\ "@[<v 0>This revelation was BACKTRACKED, \
its expected effects were NOT applied.@]" ; its expected effects were NOT applied.@]" ;
| Applied Delegation_result -> | Applied Delegation_result ->
Format.fprintf ppf Format.fprintf ppf
"This delegation was successfully applied" "This delegation was successfully applied"
| Backtracked (Delegation_result, _) -> | Backtracked (Delegation_result, _) ->
Format.fprintf ppf Format.fprintf ppf
"@<v 0>This delegation was BACKTRACKED,@,\ "@[<v 0>This delegation was BACKTRACKED, \
its expected effects were NOT applied.@]" ; its expected effects were NOT applied.@]" ;
| Applied (Transaction_result _ as tx) -> | Applied (Transaction_result _ as tx) ->
Format.fprintf ppf Format.fprintf ppf
@ -236,7 +236,7 @@ let pp_manager_operation_contents_and_result ppf
pp_transaction_result tx pp_transaction_result tx
| Backtracked (Transaction_result _ as tx, _errs) -> | Backtracked (Transaction_result _ as tx, _errs) ->
Format.fprintf ppf Format.fprintf ppf
"@<v 0>This transaction was BACKTRACKED,@,\ "@[<v 0>This transaction was BACKTRACKED, \
its expected effects (as follow) were NOT applied.@]" ; its expected effects (as follow) were NOT applied.@]" ;
pp_transaction_result tx pp_transaction_result tx
| Applied (Origination_result _ as op) -> | Applied (Origination_result _ as op) ->
@ -245,7 +245,7 @@ let pp_manager_operation_contents_and_result ppf
pp_origination_result op pp_origination_result op
| Backtracked (Origination_result _ as op, _errs) -> | Backtracked (Origination_result _ as op, _errs) ->
Format.fprintf ppf Format.fprintf ppf
"@<v 0>This origination was BACKTRACKED,@,\ "@[<v 0>This origination was BACKTRACKED, \
its expected effects (as follow) were NOT applied.@]" ; its expected effects (as follow) were NOT applied.@]" ;
pp_origination_result op in pp_origination_result op in
Format.fprintf ppf Format.fprintf ppf