Skip to content

Commit

Permalink
Attempt to ensure messages are output in the correct order
Browse files Browse the repository at this point in the history
  • Loading branch information
Vagabond committed Jul 10, 2018
1 parent 220b9d0 commit 567760a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/hbbft_acs.erl
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ handle_msg(Data = #acs_data{n=N, f=F}, J, {{bba, I}, BBAMsg}) ->
Acc
end
end, {NewData, []}, lists:seq(0, N - 1)),
%% each BBA is independant, so the total ordering here is unimportant
{NextData#acs_data{done=true}, {send, lists:flatten(Replies)}};
false ->
check_completion(NewData)
Expand Down
4 changes: 2 additions & 2 deletions src/hbbft_bba.erl
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ bval(Data=#bba_data{n=N, f=F}, Id, V) ->
true ->
%% XXX How many times do we send AUX per round? I think just once
Random = rand_val(NewData2#bba_data.bin_values),
{NewData2#bba_data{aux_sent = true}, [{multicast, {aux, NewData2#bba_data.round, Random}} | ToSend]};
{NewData2#bba_data{aux_sent = true}, ToSend ++ [{multicast, {aux, NewData2#bba_data.round, Random}}]};
false ->
{NewData2, ToSend}
end,
Expand All @@ -192,7 +192,7 @@ bval(Data=#bba_data{n=N, f=F}, Id, V) ->
%% TODO need more entropy for the SID
%% We have enough AUX and CON messages to reveal our share of the coin
{CoinData, {send, CoinSend}} = hbbft_cc:get_coin(maybe_init_coin(NewData3)),
{NewData3#bba_data{coin=CoinData, coin_sent=true}, {send, hbbft_utils:wrap({coin, Data#bba_data.round}, CoinSend) ++ ToSend2}};
{NewData3#bba_data{coin=CoinData, coin_sent=true}, {send, ToSend2 ++ hbbft_utils:wrap({coin, Data#bba_data.round}, CoinSend)}};
_ ->
{NewData3, {send, ToSend2}}
end;
Expand Down

0 comments on commit 567760a

Please sign in to comment.