Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AKI-449: BlockchainTestUtils functionality to generate random Unity chains #1031

Merged
merged 3 commits into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public class AionBlockchainImpl implements IAionBlockchain {
private final GreatGrandParentBlockHeaderValidator unityGreatGrandParentBlockHeaderValidator;
private final ParentBlockHeaderValidator preUnityParentBlockHeaderValidator;
private final ParentBlockHeaderValidator unityParentBlockHeaderValidator;
private final StakingContractHelper stakingContractHelper;
private StakingContractHelper stakingContractHelper = null;
public final ForkUtility forkUtility;
public final BeaconHashValidator beaconHashValidator;

Expand Down Expand Up @@ -248,13 +248,6 @@ protected AionBlockchainImpl(

// initialize beacon hash validator
this.beaconHashValidator = new BeaconHashValidator(this, this.forkUtility);

stakingContractHelper =
new StakingContractHelper(
forTest
? AddressUtils.ZERO_ADDRESS
: CfgAion.inst().getGenesis().getStakingContractAddress(),
this);
}

/**
Expand Down Expand Up @@ -2546,6 +2539,9 @@ public synchronized StakingBlock createStakingBlockTemplate(
}

public StakingContractHelper getStakingContractHelper() {
if (stakingContractHelper == null) {
stakingContractHelper = new StakingContractHelper(CfgAion.inst().getGenesis().getStakingContractAddress(), this);
}
return stakingContractHelper;
}

Expand Down
4 changes: 3 additions & 1 deletion modAionImpl/src/org/aion/zero/impl/types/AionGenesis.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.aion.zero.impl.types;

import com.google.common.annotations.VisibleForTesting;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.util.ArrayList;
Expand Down Expand Up @@ -172,7 +173,8 @@ private void setNetworkBalance(Map<Integer, BigInteger> networkBalances) {
this.networkBalances = networkBalances;
}

private void setStakingContractAddress(AionAddress address) {
@VisibleForTesting
public void setStakingContractAddress(AionAddress address) {
stakingContractAddress = address;
}

Expand Down
Loading