From e7a25466afb6071f4b586e59489e5b56832d16ad Mon Sep 17 00:00:00 2001 From: Marc Nijdam Date: Wed, 11 May 2022 12:48:35 -0600 Subject: [PATCH] Fix receipts_v2 mismatch (#424) --- src/bh_route_txns.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bh_route_txns.erl b/src/bh_route_txns.erl index 254071d0..9a78e57a 100644 --- a/src/bh_route_txns.erl +++ b/src/bh_route_txns.erl @@ -761,7 +761,7 @@ txn_to_json({Height, Time, Hash, Type, Fields}) when is_map(Fields) -> txn_to_json({poc_request_v1, #{<<"location">> := Location} = Fields}) -> ?INSERT_LAT_LON(Location, Fields); txn_to_json( - {Type, #{<<"challenger_location">> := ChallengerLoc, <<"path">> := Path} = Fields} + {Type, #{<<"path">> := Path} = Fields} ) when Type == poc_receipts_v1 orelse Type == poc_receipts_v2 -> %% update witnesses to include location_hex at res8 WitnessLocationHex = fun(PathElem) -> @@ -810,6 +810,7 @@ txn_to_json( end, lists:zip(lists:seq(1, length(Path)), Path) ), + ChallengerLoc = maps:get(<<"challenger_location">>, Fields, undefined), ?INSERT_LAT_LON(ChallengerLoc, {<<"challenger_lat">>, <<"challenger_lon">>}, Fields#{ <<"path">> => NewPath });