Skip to content

Commit

Permalink
Explicitly pass the round number to hbbft:next_round/3
Browse files Browse the repository at this point in the history
  • Loading branch information
Vagabond committed Sep 21, 2018
1 parent cac7a71 commit f1faf13
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/hbbft.erl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
finalize_round/3,
finalize_round/2,
next_round/1,
next_round/2,
next_round/3,
round/1,
get_encrypted_key/2,
encrypt/2,
Expand Down Expand Up @@ -141,14 +141,14 @@ next_round(Data = #hbbft_data{secret_key=SK, n=N, f=F, j=J}) ->
sig_shares=#{}, thingtosign=undefined},
maybe_start_acs(NewData).

-spec next_round(hbbft_data(), [binary()]) -> {hbbft_data(), ok | {send, []}}.
next_round(Data = #hbbft_data{secret_key=SK, n=N, f=F, j=J, buf=Buf}, TransactionsToRemove) ->
-spec next_round(hbbft_data(), pos_integer(), [binary()]) -> {hbbft_data(), ok | {send, []}}.
next_round(Data = #hbbft_data{secret_key=SK, n=N, f=F, j=J, buf=Buf}, NextRound, TransactionsToRemove) ->
%% remove the request transactions
NewBuf = lists:filter(fun(Item) ->
not lists:member(Item, TransactionsToRemove)
end, Buf),
%% reset all the round-dependant bits of the state and increment the round
NewData = Data#hbbft_data{round=Data#hbbft_data.round + 1, acs=hbbft_acs:init(SK, N, F, J),
NewData = Data#hbbft_data{round=NextRound, acs=hbbft_acs:init(SK, N, F, J),
acs_init=false, acs_results=[],
sent_txns=false, sent_sig=false,
dec_shares=#{}, decrypted=#{}, buf=NewBuf,
Expand Down

0 comments on commit f1faf13

Please sign in to comment.