Skip to content

Commit

Permalink
Change deposit receipts util
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Mar 19, 2024
1 parent a0401d6 commit 6df7ccf
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState;
import tech.pegasys.teku.spec.logic.common.helpers.MiscHelpers;

/**
* Generates deposit receipts for a given slot with a probability of {@link
* DepositReceiptsUtil#PROBABILITY_OF_DEPOSIT}
*/
public class DepositReceiptsUtil {

private static final float PROBABILITY_OF_NO_DEPOSIT = 0.5f;
private static final float PROBABILITY_OF_DEPOSIT = 0.5f;
private static final int MAX_NUMBER_OF_DEPOSITS_PER_BLOCK = 3;

private final Spec spec;
Expand All @@ -51,7 +55,7 @@ public List<DepositReceipt> generateDepositReceipts(final BeaconState state) {
}

private int getNumberOfDepositReceiptsToGenerate() {
if (random.nextFloat() < PROBABILITY_OF_NO_DEPOSIT) {
if (random.nextFloat() > PROBABILITY_OF_DEPOSIT) {
return 0;
}
return random.nextInt(1, MAX_NUMBER_OF_DEPOSITS_PER_BLOCK + 1);
Expand Down

0 comments on commit 6df7ccf

Please sign in to comment.