diff --git a/src/state_channel/blockchain_state_channel_common.erl b/src/state_channel/blockchain_state_channel_common.erl index 1c1ac48321..f8c0d78b0a 100644 --- a/src/state_channel/blockchain_state_channel_common.erl +++ b/src/state_channel/blockchain_state_channel_common.erl @@ -213,8 +213,7 @@ handle_server_msg( BannerSC -> lager:debug("sc_handler client got banner, sc_id: ~p", [blockchain_state_channel_v1:id(BannerSC)]), - %% either we don't have a ledger or we do and the SC is valid - case Ledger == undefined orelse is_active_sc(BannerSC, Ledger) == ok of + case is_active_sc(BannerSC, Ledger) == ok of true -> blockchain_state_channels_client:banner(Banner, self()); false -> @@ -225,8 +224,7 @@ handle_server_msg( PurchaseSC = blockchain_state_channel_purchase_v1:sc(Purchase), lager:debug("sc_handler client got purchase, sc_id: ~p", [blockchain_state_channel_v1:id(PurchaseSC)]), - %% either we don't have a ledger or we do and the SC is valid - case Ledger == undefined orelse is_active_sc(PurchaseSC, Ledger) == ok of + case is_active_sc(PurchaseSC, Ledger) == ok of true -> blockchain_state_channels_client:purchase(Purchase, self()); false -> @@ -253,8 +251,7 @@ handle_client_msg(Msg, HandlerState) -> BannerSC -> lager:debug("sc_handler client got banner, sc_id: ~p", [blockchain_state_channel_v1:id(BannerSC)]), - %% either we don't have a ledger or we do and the SC is valid - case Ledger == undefined orelse is_active_sc(BannerSC, Ledger) == ok of + case is_active_sc(BannerSC, Ledger) == ok of true -> blockchain_state_channels_client:banner(Banner, self()); false -> @@ -265,8 +262,7 @@ handle_client_msg(Msg, HandlerState) -> PurchaseSC = blockchain_state_channel_purchase_v1:sc(Purchase), lager:debug("sc_handler client got purchase, sc_id: ~p", [blockchain_state_channel_v1:id(PurchaseSC)]), - %% either we don't have a ledger or we do and the SC is valid - case Ledger == undefined orelse is_active_sc(PurchaseSC, Ledger) == ok of + case is_active_sc(PurchaseSC, Ledger) == ok of true -> blockchain_state_channels_client:purchase(Purchase, self()); false -> diff --git a/src/state_channel/blockchain_state_channel_handler.erl b/src/state_channel/blockchain_state_channel_handler.erl index dd5ab68e50..9f3e922902 100644 --- a/src/state_channel/blockchain_state_channel_handler.erl +++ b/src/state_channel/blockchain_state_channel_handler.erl @@ -111,8 +111,7 @@ handle_data(client, Data, HandlerState) -> BannerSC -> lager:debug("sc_handler client got banner, sc_id: ~p", [blockchain_state_channel_v1:id(BannerSC)]), - %% either we don't have a ledger or we do and the SC is valid - case Ledger == undefined orelse blockchain_state_channel_common:is_active_sc(BannerSC, Ledger) == ok of + case blockchain_state_channel_common:is_active_sc(BannerSC, Ledger) == ok of true -> blockchain_state_channels_client:banner(Banner, self()); false -> @@ -123,8 +122,7 @@ handle_data(client, Data, HandlerState) -> PurchaseSC = blockchain_state_channel_purchase_v1:sc(Purchase), lager:debug("sc_handler client got purchase, sc_id: ~p", [blockchain_state_channel_v1:id(PurchaseSC)]), - %% either we don't have a ledger or we do and the SC is valid - case Ledger == undefined orelse blockchain_state_channel_common:is_active_sc(PurchaseSC, Ledger) == ok of + case blockchain_state_channel_common:is_active_sc(PurchaseSC, Ledger) == ok of true -> blockchain_state_channels_client:purchase(Purchase, self()); false ->