Skip to content

Commit

Permalink
Merge pull request #35 from helium/adt/get-set-stamp-fun
Browse files Browse the repository at this point in the history
Add getter/setter for stamp fun
  • Loading branch information
Vagabond committed Jan 17, 2019
2 parents 5c65417 + 1a5a8b5 commit 05bdf93
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/hbbft.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

-export([init/6,
init/7,
get_stamp_fun/1,
set_stamp_fun/4,
start_on_demand/1,
input/2,
finalize_round/3,
Expand Down Expand Up @@ -94,6 +96,14 @@ init(SK, N, F, J, BatchSize, MaxBuf) ->
init(SK, N, F, J, BatchSize, MaxBuf, {M, Fn, A}) ->
#hbbft_data{secret_key=SK, n=N, f=F, j=J, batch_size=BatchSize, acs=hbbft_acs:init(SK, N, F, J), max_buf=MaxBuf, stampfun={M, Fn, A}}.

-spec get_stamp_fun(hbbft_data()) -> {atom(), atom(), list()} | undefined.
get_stamp_fun(#hbbft_data{stampfun=S}) ->
S.

-spec set_stamp_fun(atom(), atom(), list(), hbbft_data()) -> hbbft_data().
set_stamp_fun(M, F, A, Data) when is_atom(M), is_atom(F) ->
Data#hbbft_data{stampfun={M, F, A}}.

%% start acs on demand
-spec start_on_demand(hbbft_data()) -> {hbbft_data(), already_started | {send, [rbc_wrapped_output()]}}.
start_on_demand(Data = #hbbft_data{buf=Buf, n=N, secret_key=SK, batch_size=BatchSize, acs_init=false}) ->
Expand Down

0 comments on commit 05bdf93

Please sign in to comment.