From 3690566b0b48829076d461dd9fcc90d8761317d5 Mon Sep 17 00:00:00 2001 From: Sebastien Mondet Date: Tue, 12 Feb 2019 14:03:44 -0500 Subject: [PATCH] =?UTF-8?q?Fix=20client=20display=20for=20=E2=80=9Cunspeci?= =?UTF-8?q?fied=E2=80=9D=20chain-id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib_signer_backends/ledger.ml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib_signer_backends/ledger.ml b/src/lib_signer_backends/ledger.ml index 322fe931e..ea29236c7 100644 --- a/src/lib_signer_backends/ledger.ml +++ b/src/lib_signer_backends/ledger.ml @@ -456,6 +456,12 @@ let curve_of_id = function | Pkh pkh -> return (curve_of_pkh pkh) | Animals (a, curve_opt) -> unopt_curve a curve_opt +(* The Ledger uses a special value 0x00000000 for the “any” chain-id: *) +let pp_ledger_chain_id fmt s = + match s with + | "\x00\x00\x00\x00" -> Format.fprintf fmt "'Unspecified'" + | other -> Format.fprintf fmt "%a" Chain_id.pp (Chain_id.of_string_exn other) + let sign ?watermark sk_uri msg = id_of_sk_uri sk_uri >>=? fun id -> with_ledger id begin fun ledger { major; minor; patch; _ } _of_curve _of_pkh -> @@ -776,7 +782,7 @@ let commands = * Main chain ID: %a -> %a@.\ * Main chain High Watermark: %ld -> %ld@.\ * Test chain High Watermark: %ld -> %ld" - Chain_id.pp (Chain_id.of_string_exn current_ci) + pp_ledger_chain_id current_ci Chain_id.pp main_chain_id current_mh main_hwm current_th test_hwm @@ -831,7 +837,7 @@ let commands = "The high water mark values for@ %a@ are\ @ %ld for the main-chain@ (%a)@ \ and@ %ld for the test-chain." - pp_id id mh Chain_id.pp Chain_id.(of_string_exn ci) th + pp_id id mh pp_ledger_chain_id ci th >>= fun () -> return_unit end