use of org.aion.base.InternalVmType in project aion by aionnetwork.
the class ExternalStateForAvm method getVmType.
private InternalVmType getVmType(AionAddress destination) {
// will load contract into memory otherwise leading to consensus issues
RepositoryCache track = repositoryCache.startTracking();
AccountState accountState = track.getAccountState(destination);
InternalVmType vm;
if (accountState == null) {
// the address doesn't exist yet, so it can be used by either vm
vm = InternalVmType.EITHER;
} else {
vm = repositoryCache.getVMUsed(destination, accountState.getCodeHash());
// UNKNOWN is returned when there was no contract information stored
if (vm == InternalVmType.UNKNOWN) {
// use the in-memory value
vm = track.getVmType(destination);
}
}
return vm;
}
Aggregations