use of org.ethereum.jsontestsuite.model.AccountTck in project rskj by rsksmart.
the class RepositoryBuilder method build.
public static Repository build(Map<String, AccountTck> accounts) {
HashMap<RskAddress, AccountState> stateBatch = new HashMap<>();
HashMap<RskAddress, ContractDetails> detailsBatch = new HashMap<>();
for (String address : accounts.keySet()) {
RskAddress addr = new RskAddress(address);
AccountTck accountTCK = accounts.get(address);
AccountBuilder.StateWrap stateWrap = AccountBuilder.build(accountTCK);
AccountState state = stateWrap.getAccountState();
ContractDetails details = stateWrap.getContractDetails();
stateBatch.put(addr, state);
ContractDetailsCacheImpl detailsCache = new ContractDetailsCacheImpl(details);
detailsCache.setDirty(true);
detailsBatch.put(addr, detailsCache);
}
RepositoryImpl repositoryDummy = new RepositoryImpl(new RskSystemProperties(), new TrieStoreImpl(new HashMapDB()));
Repository track = repositoryDummy.startTracking();
track.updateBatch(stateBatch, detailsBatch);
track.commit();
return repositoryDummy;
}
Aggregations