Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
Add blockchain_txn:is_valid (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vagabond authored Apr 16, 2019
1 parent b9aa0f7 commit c520c66
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/transactions/blockchain_txn.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
serialize/1,
deserialize/1,
wrap_txn/1,
unwrap_txn/1
unwrap_txn/1,
is_valid/2
]).

-ifdef(TEST).
Expand Down Expand Up @@ -200,6 +201,22 @@ absorb(Txn, Chain) ->
What:Why:Stack ->
{error, {Type, What, {Why, Stack}}}
end.

%%--------------------------------------------------------------------
%% @doc
%% @end
%%--------------------------------------------------------------------
-spec is_valid(txn(), blockchain:blockchain()) -> ok | {error, any()}.
is_valid(Txn, Chain) ->
Type = ?MODULE:type(Txn),
try Type:is_valid(Txn, Chain) of
Res ->
Res
catch
What:Why:Stack ->
{error, {Type, What, {Why, Stack}}}
end.

%%--------------------------------------------------------------------
%% @doc
%% @end
Expand Down

0 comments on commit c520c66

Please sign in to comment.