本文整理汇总了Java中org.ethereum.config.BlockchainConfig类的典型用法代码示例。如果您正苦于以下问题:Java BlockchainConfig类的具体用法?Java BlockchainConfig怎么用?Java BlockchainConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlockchainConfig类属于org.ethereum.config包,在下文中一共展示了BlockchainConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getContractForAddress
import org.ethereum.config.BlockchainConfig; //导入依赖的package包/类
public static PrecompiledContract getContractForAddress(DataWord address, BlockchainConfig config) {
if (address == null) return identity;
if (address.equals(ecRecoverAddr)) return ecRecover;
if (address.equals(sha256Addr)) return sha256;
if (address.equals(ripempd160Addr)) return ripempd160;
if (address.equals(identityAddr)) return identity;
// Byzantium precompiles
if (address.equals(modExpAddr) && config.eip198()) return modExp;
if (address.equals(altBN128AddAddr) && config.eip213()) return altBN128Add;
if (address.equals(altBN128MulAddr) && config.eip213()) return altBN128Mul;
if (address.equals(altBN128PairingAddr) && config.eip212()) return altBN128Pairing;
return null;
}
示例2: add
import org.ethereum.config.BlockchainConfig; //导入依赖的package包/类
public void add(long startBlockNumber, BlockchainConfig config) {
if (count >= blockNumbers.length) {
throw new RuntimeException();
}
if (count > 0 && blockNumbers[count] >= startBlockNumber) {
throw new RuntimeException("Block numbers should increase");
}
if (count == 0 && startBlockNumber > 0) {
throw new RuntimeException("First config should start from block 0");
}
blockNumbers[count] = startBlockNumber;
configs[count] = config;
count++;
}
示例3: getConfigForBlock
import org.ethereum.config.BlockchainConfig; //导入依赖的package包/类
@Override
public BlockchainConfig getConfigForBlock(long blockNumber) {
for (int i = 0; i < count; i++) {
if (blockNumber < blockNumbers[i]) {
return configs[i - 1];
}
}
return configs[count - 1];
}
示例4: add
import org.ethereum.config.BlockchainConfig; //导入依赖的package包/类
public void add(long startBlockNumber, BlockchainConfig config) {
if (count >= blockNumbers.length) throw new RuntimeException();
if (count > 0 && blockNumbers[count] >= startBlockNumber)
throw new RuntimeException("Block numbers should increase");
if (count == 0 && startBlockNumber > 0) throw new RuntimeException("First config should start from block 0");
blockNumbers[count] = startBlockNumber;
configs[count] = config;
count++;
}
示例5: getConfigForBlock
import org.ethereum.config.BlockchainConfig; //导入依赖的package包/类
@Override
public BlockchainConfig getConfigForBlock(long blockNumber) {
for (int i = 0; i < count; i++) {
if (blockNumber < blockNumbers[i]) return configs[i - 1];
}
return configs[count - 1];
}
示例6: Eip160HFConfig
import org.ethereum.config.BlockchainConfig; //导入依赖的package包/类
public Eip160HFConfig(BlockchainConfig parent) {
super(parent);
constants = new ConstantsAdapter(parent.getConstants()) {
@Override
public int getMAX_CONTRACT_SZIE() {
return 0x6000;
}
};
}
示例7: initDaoConfig
import org.ethereum.config.BlockchainConfig; //导入依赖的package包/类
@Override
protected void initDaoConfig(BlockchainConfig parent, long forkBlockNumber) {
super.initDaoConfig(parent, forkBlockNumber);
try {
ObjectMapper objectMapper = new ObjectMapper();
DaoAcct[] daoAccts = objectMapper.readValue(accountsJson.replace('\'', '"'), DaoAcct[].class);
for (DaoAcct daoAcct : daoAccts) {
daoAccounts.add(Hex.decode(daoAcct.address.substring(2)));
daoAccounts.add(Hex.decode(daoAcct.extraBalanceAccount.substring(2)));
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例8: ByzantiumConfig
import org.ethereum.config.BlockchainConfig; //导入依赖的package包/类
public ByzantiumConfig(BlockchainConfig parent) {
super(parent);
constants = new ConstantsAdapter(super.getConstants()) {
private final BigInteger BLOCK_REWARD = new BigInteger("3000000000000000000");
@Override
public BigInteger getBLOCK_REWARD() {
return BLOCK_REWARD;
}
};
}
示例9: initDaoConfig
import org.ethereum.config.BlockchainConfig; //导入依赖的package包/类
protected void initDaoConfig(BlockchainConfig parent, long forkBlockNumber) {
this.parent = parent;
this.constants = parent.getConstants();
this.forkBlockNumber = forkBlockNumber;
BlockHeaderRule rule = new ExtraDataPresenceRule(DAO_EXTRA_DATA, supportFork);
headerValidators().add(Pair.of(forkBlockNumber, new BlockHeaderValidator(rule)));
}
示例10: getConfigForBlock
import org.ethereum.config.BlockchainConfig; //导入依赖的package包/类
@Override
public BlockchainConfig getConfigForBlock(long blockHeader) {
return this;
}
示例11: getBlockchainConfig
import org.ethereum.config.BlockchainConfig; //导入依赖的package包/类
public BlockchainConfig getBlockchainConfig() {
return blockchainConfig;
}
示例12: DaoNoHFConfig
import org.ethereum.config.BlockchainConfig; //导入依赖的package包/类
public DaoNoHFConfig(BlockchainConfig parent, long forkBlockNumber) {
initDaoConfig(parent, forkBlockNumber);
}
示例13: RopstenConfig
import org.ethereum.config.BlockchainConfig; //导入依赖的package包/类
public RopstenConfig(BlockchainConfig parent) {
super(parent);
headerValidators().add(Pair.of(CHECK_BLOCK_NUMBER, new BlockHeaderValidator(new BlockCustomHashRule(CHECK_BLOCK_HASH))));
}
示例14: DaoHFConfig
import org.ethereum.config.BlockchainConfig; //导入依赖的package包/类
public DaoHFConfig(BlockchainConfig parent, long forkBlockNumber) {
initDaoConfig(parent, forkBlockNumber);
}
示例15: Eip150HFConfig
import org.ethereum.config.BlockchainConfig; //导入依赖的package包/类
public Eip150HFConfig(BlockchainConfig parent) {
this.parent = parent;
}