Merge pull request #177 from ligi/ligi/code_review/simplify_is_exist

simplify
This commit is contained in:
skype me: roman.mandeleil 2014-12-25 11:06:10 +02:00
commit 0d6638e19b
1 changed files with 3 additions and 7 deletions

View File

@ -69,16 +69,12 @@ public class RepositoryTrack implements Repository {
@Override @Override
public boolean isExist(byte[] addr) { public boolean isExist(byte[] addr) {
boolean exist = false;
AccountState accountState = cacheAccounts.get(wrap(addr)); AccountState accountState = cacheAccounts.get(wrap(addr));
if (accountState != null && !accountState.isDeleted()) exist = true; if (accountState != null) return !accountState.isDeleted();
if (accountState == null){ accountState = repository.getAccountState(addr);
accountState = repository.getAccountState(addr); return accountState != null && !accountState.isDeleted();
if (accountState != null && !accountState.isDeleted()) exist = true;
}
return exist;
} }