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

Commit

Permalink
Merge pull request #678 from helium/adt/fix-txn-order
Browse files Browse the repository at this point in the history
Codify implicit sorting of oracle submissions before txn close & fix …
  • Loading branch information
evanmcc authored Nov 17, 2020
2 parents 4fcd506 + 499a932 commit 58711fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/handlers/blockchain_sync_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ handle_data(client, Data0, #state{blockchain=Chain, path=Path}=State) ->
ok ->
{noreply, State, blockchain_sync_handler_pb:encode_msg(#blockchain_sync_req_pb{msg={response, true}})};
_Error ->
lager:info("Error adding blocks ~p", [_Error]),
%% TODO: maybe dial for sync again?
{stop, normal, State, blockchain_sync_handler_pb:encode_msg(#blockchain_sync_req_pb{msg={response, false}})}
end;
Expand Down
7 changes: 4 additions & 3 deletions src/transactions/blockchain_txn.erl
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@
{blockchain_txn_payment_v2, 19},
{blockchain_txn_state_channel_open_v1, 20},
{blockchain_txn_update_gateway_oui_v1, 21},
{blockchain_txn_state_channel_close_v1, 22},
{blockchain_txn_transfer_hotspot_v1, 23}
{blockchain_txn_price_oracle_v1, 22},
{blockchain_txn_state_channel_close_v1, 23},
{blockchain_txn_transfer_hotspot_v1, 24}
]).

block_delay() ->
Expand Down Expand Up @@ -636,7 +637,7 @@ type_order(Txn) ->
Type = type(Txn),
case lists:keyfind(Type, 1, ?ORDER) of
{Type, Index} -> Index;
false -> erlang:length(?ORDER)
false -> erlang:length(?ORDER) + 1
end.

%%--------------------------------------------------------------------
Expand Down

0 comments on commit 58711fb

Please sign in to comment.