diff --git a/src/gmmpp_msgs.erl b/src/gmmpp_msgs.erl index 7f1e68f..45c8785 100644 --- a/src/gmmpp_msgs.erl +++ b/src/gmmpp_msgs.erl @@ -173,17 +173,6 @@ encode(#{reply := Reply0}, P, V) when is_map(Reply0) -> {Id, Reply} = maps:take(id, Reply0), encode_reply(Reply, Id, P, V). -encode_msg(#{solutions := #{}} = Msg0, ?PROTOCOL_JSON, Vsn) -> - #{solutions := #{ seq := Seq - , found := Found }} = validate(Msg0, Vsn), - EncFound = lists:map( - fun(#{ nonce := Nonce - , evidence := Evidence }) -> - #{ <<"n">> => Nonce - , <<"e">> => Evidence } - end, Found), - json_encode(#{ <<"solutions">> => #{ <<"seq">> => Seq - , <<"found">> => EncFound }}); encode_msg(Msg0, ?PROTOCOL_JSON, Vsn) -> Msg = validate(Msg0, Vsn), [{Method, Args}] = maps:to_list(Msg), @@ -289,12 +278,12 @@ decode_msg_(<<"candidate">>, #{ <<"candidate">> := C decode_msg_(<<"solutions">>, #{ <<"seq">> := Seq , <<"found">> := Found }) -> Solutions = lists:map( - fun(#{ <<"n">> := Nonce - , <<"e">> := Evidence }) -> + fun(#{ <<"nonce">> := Nonce + , <<"evidence">> := Evidence }) -> #{nonce => Nonce, evidence => Evidence} end, Found), - #{solution => #{ seq => Seq - , found => Solutions }}; + #{solutions => #{ seq => Seq + , found => Solutions }}; decode_msg_(<<"solution_accepted">>, #{<<"seq">> := Seq}) -> #{solution_accepted => #{seq => Seq}}; decode_msg_(<<"no_solution">>, #{ <<"seq">> := Seq