Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1887 from helium/adt/isolate-var-txns
Browse files Browse the repository at this point in the history
If the `isolate_var_txns` var is set, put var txns in their own block
  • Loading branch information
Vagabond authored Jan 23, 2023
2 parents dfdcf1c + fa86d1b commit 7693655
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{<<"base64url">>,{pkg,<<"base64url">>,<<"1.0.1">>},1},
{<<"blockchain">>,
{git,"https://github.com/helium/blockchain-core.git",
{ref,"abec0d7fea2477da857a2ceebd9a717909150399"}},
{ref,"7db8d2662220281eeb52d9852d4a7a4693889ac4"}},
0},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.9.0">>},2},
{<<"chatterbox">>,
Expand Down
9 changes: 8 additions & 1 deletion src/miner.erl
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,14 @@ select_transactions(Chain, Txns, {ElectionEpoch0, EpochStart0}, BlockHeightCurr,
),
{Epoch, BlockHeightNext, Transactions, InvalidTransactions};
_ ->
{ElectionEpoch0, EpochStart0, ValidTransactions, InvalidTransactions}
%% try to isolate the var txn in its own block
case {blockchain:config(?isolate_var_txns, Ledger), lists:filter(fun(T) -> blockchain_txn:type(T) == blockchain_txn_vars_v1 end, ValidTransactions)} of
{{ok, true}, [VarTxn|_]} ->
%% take the first var txn found as the only txn in a block
{ElectionEpoch0, EpochStart0, [VarTxn], InvalidTransactions};
_ ->
{ElectionEpoch0, EpochStart0, ValidTransactions, InvalidTransactions}
end
end.

-spec txn_is_rewards(blockchain_txn:txn()) -> boolean().
Expand Down

0 comments on commit 7693655

Please sign in to comment.