From 72141c8ecbb82df829d6b075bc925ae57143a731 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Wed, 9 Sep 2015 21:06:40 +0900 Subject: [PATCH] WIP: split A30 into A30/A31 based on AllHosed --- src/machi_chain_manager1.erl | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/machi_chain_manager1.erl b/src/machi_chain_manager1.erl index 62b0fbc..a331b20 100644 --- a/src/machi_chain_manager1.erl +++ b/src/machi_chain_manager1.erl @@ -1205,11 +1205,24 @@ react_to_env_A30(Retries, P_latest, LatestUnanimousP, P_current_calc, #ch_mgr{name=MyName} = S) -> ?REACT(a30), AllHosed = get_unfit_list(S#ch_mgr.fitness_svr), + ?REACT({a30, ?LINE, [{all_hosed, AllHosed}]}), + case lists:member(MyName, AllHosed) of + true -> + react_to_env_A50(P_latest, [{i_am_hosed, AllHosed}], S); + false -> + react_to_env_A31(Retries, P_latest, LatestUnanimousP, + P_current_calc, AllHosed, S) + end. + +react_to_env_A31(Retries, P_latest, LatestUnanimousP, P_current_calc, + AllHosed, #ch_mgr{name=MyName} = S) -> {P_newprop1, S2,_Up} = calc_projection(S, MyName, AllHosed, P_current_calc), - ?REACT({a30, ?LINE, [{current, machi_projection:make_summary(S#ch_mgr.proj)}]}), - ?REACT({a30, ?LINE, [{calc_current, machi_projection:make_summary(P_current_calc)}]}), - ?REACT({a30, ?LINE, [{newprop1, machi_projection:make_summary(P_newprop1)}]}), - ?REACT({a30, ?LINE, [{latest, machi_projection:make_summary(P_latest)}]}), + ?REACT({a30, ?LINE, + [{current, machi_projection:make_summary(S#ch_mgr.proj)}, + {calc_current, machi_projection:make_summary(P_current_calc)}, + {latest, machi_projection:make_summary(P_latest)}, + {newprop1, machi_projection:make_summary(P_newprop1)} + ]}), {P_newprop2, S3} = {P_newprop1, S2},