Skip to content
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
6 changes: 0 additions & 6 deletions src/main/java/org/tron/common/runtime/Runtime.java
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,6 @@ private void create()
if (percent < 0 || percent > 100) {
throw new ContractExeException("percent must be >= 0 and <= 100");
}
// insure one owner just have one contract
// if (this.deposit.getContractByNormalAccount(ownerAddress) != null) {
// logger.error("Trying to create second contract with one account: address: " + Wallet
// .encode58Check(ownerAddress));
// return;
// }

// insure the new contract address haven't exist
if (deposit.getAccount(contractAddress) != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,6 @@ public AccountCapsule getAccount(byte[] addr) {
return deposit.getAccount(addr);
}

@Override
public BytesCapsule getContractByNormalAccount(byte[] address) {
return deposit.getContractByNormalAccount(address);
}

@Override
public void createContractByNormalAccountIndex(byte[] address,
BytesCapsule contractAddress) {
deposit.createContractByNormalAccountIndex(address, contractAddress);
}

@Override
public void createContract(byte[] codeHash, ContractCapsule contractCapsule) {
deposit.createContract(codeHash, contractCapsule);
Expand Down Expand Up @@ -195,11 +184,6 @@ public void putContract(Key key, Value value) {
deposit.putContract(key, value);
}

@Override
public void putContractByNormalAccountIndex(Key key, Value value) {
deposit.putContractByNormalAccountIndex(key, value);
}

@Override
public void putStorage(Key key, Storage cache) {
deposit.putStorage(key, cache);
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/org/tron/common/storage/Deposit.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public interface Deposit {

void createContract(byte[] address, ContractCapsule contractCapsule);

void createContractByNormalAccountIndex(byte[] address, BytesCapsule contractAddress);

ContractCapsule getContract(byte[] address);

void saveCode(byte[] codeHash, byte[] code);
Expand Down Expand Up @@ -69,8 +67,6 @@ public interface Deposit {

void putContract(Key key, Value value);

void putContractByNormalAccountIndex(Key key, Value value);

void putStorage(Key key, Storage cache);

void putVotes(Key key, Value value);
Expand All @@ -83,8 +79,6 @@ public interface Deposit {

BlockCapsule getBlock(byte[] blockHash);

BytesCapsule getContractByNormalAccount(byte[] address);

long computeAfterRunStorageSize();

long getBeforeRunStorageSize();
Expand Down
53 changes: 0 additions & 53 deletions src/main/java/org/tron/common/storage/DepositImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.tron.core.capsule.BytesCapsule;
import org.tron.core.capsule.ContractCapsule;
import org.tron.core.capsule.TransactionCapsule;
import org.tron.core.db.AccountContractIndexStore;
import org.tron.core.db.AccountStore;
import org.tron.core.db.AssetIssueStore;
import org.tron.core.db.BlockStore;
Expand Down Expand Up @@ -99,10 +98,6 @@ private AssetIssueStore getAssetIssueStore() {
return dbManager.getAssetIssueStore();
}

private AccountContractIndexStore getAccountContractIndexStore() {
return dbManager.getAccountContractIndexStore();
}

@Override
public Deposit newDepositChild() {
return new DepositImpl(dbManager, this, null);
Expand Down Expand Up @@ -154,44 +149,13 @@ public synchronized AccountCapsule getAccount(byte[] address) {
return accountCapsule;
}


public synchronized BytesCapsule getContractByNormalAccount(byte[] address) {

Key key = new Key(address);
if (accountContractIndexCache.containsKey(key)) {
return accountContractIndexCache.get(key).getBytes();
}

BytesCapsule contract;
if (parent != null) {
contract = parent.getContractByNormalAccount(address);
} else if (prevDeposit != null) {
contract = prevDeposit.getContractByNormalAccount(address);
} else {
contract = getAccountContractIndexStore().get(address);
}

if (contract != null) {
accountContractIndexCache.put(key, Value.create(contract.getData()));
}
return contract;
}

@Override
public synchronized void createContract(byte[] address, ContractCapsule contractCapsule) {
Key key = Key.create(address);
Value value = Value.create(contractCapsule.getData(), Type.VALUE_TYPE_CREATE);
contractCache.put(key, value);
}

@Override
public synchronized void createContractByNormalAccountIndex(byte[] address,
BytesCapsule contractAddress) {
Key key = new Key(address);
accountContractIndexCache
.put(key, Value.create(contractAddress.getData(), Type.VALUE_TYPE_CREATE));
}

@Override
public synchronized ContractCapsule getContract(byte[] address) {
Key key = Key.create(address);
Expand Down Expand Up @@ -430,11 +394,6 @@ public void putContract(Key key, Value value) {
contractCache.put(key, value);
}

@Override
public void putContractByNormalAccountIndex(Key key, Value value) {
accountContractIndexCache.put(key, value);
}

// @Override
// public void putStorage(Key key, Value value) {
// storageCache.put(key, value);
Expand Down Expand Up @@ -547,18 +506,6 @@ private void commitVoteCache(Deposit deposit) {
}));
}

private void commitAccountContractIndex(Deposit deposit) {
accountContractIndexCache.forEach(((key, value) -> {
if (value.getType().isDirty() || value.getType().isCreate()) {
if (deposit != null) {
deposit.putContractByNormalAccountIndex(key, value);
} else {
getAccountContractIndexStore().put(key.getData(), value.getBytes());
}
}
}));
}

@Override
public void syncCacheFromAccountStore(byte[] address) {
Key key = Key.create(address);
Expand Down
17 changes: 0 additions & 17 deletions src/main/java/org/tron/core/Wallet.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,23 +340,6 @@ public TransactionCapsule createTransactionCapsule(com.google.protobuf.Message m
if (percent < 0 || percent > 100) {
throw new ContractValidateException("percent must be >= 0 and <= 100");
}

// // insure one owner just have one contract
// CreateSmartContract contract = ContractCapsule
// .getSmartContractFromTransaction(trx.getInstance());
// byte[] ownerAddress = contract.getOwnerAddress().toByteArray();
// if (dbManager.getAccountContractIndexStore().get(ownerAddress) != null) {
// throw new ContractValidateException(
// "Trying to create second contract with one account: address: " + Wallet
// .encode58Check(ownerAddress));
// }

// // insure the new contract address haven't exist
// if (deposit.getAccount(contractAddress) != null) {
// logger.error("Trying to create a contract with existing contract address: " + Wallet
// .encode58Check(contractAddress));
// return;
// }
}

try {
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/org/tron/core/capsule/TransactionInfoCapsule.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,6 @@ public void addAllLog(List<Log> logs) {
.build();
}

//todo set receipt
// public void setResult(TransactionResultCapsule result) {
// this.transactionInfo = this.transactionInfo.toBuilder()
// .setResult(result.getInstance())
// .build();
// }

@Override
public byte[] getData() {
return this.transactionInfo.toByteArray();
Expand All @@ -148,11 +141,6 @@ public TransactionInfo getInstance() {
return this.transactionInfo;
}

public void parseTransactionResult(TransactionResultCapsule ret) {
setUnfreezeAmount(ret.getUnfreezeAmount());
setWithdrawAmount(ret.getWithdrawAmount());
}

public static TransactionInfoCapsule buildInstance(TransactionCapsule trxCap, Block block,
Runtime runtime, ReceiptCapsule traceReceipt) {

Expand Down
40 changes: 0 additions & 40 deletions src/main/java/org/tron/core/db/AccountContractIndexStore.java

This file was deleted.

7 changes: 0 additions & 7 deletions src/main/java/org/tron/core/db/Manager.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ public class Manager {
@Autowired
private AccountIdIndexStore accountIdIndexStore;
@Autowired
private AccountContractIndexStore accountContractIndexStore;
@Autowired
private WitnessScheduleStore witnessScheduleStore;
@Autowired
private RecentBlockStore recentBlockStore;
Expand Down Expand Up @@ -300,11 +298,6 @@ public void clearAndWriteNeighbours(Set<Node> nodes) {
this.peersStore.put("neighbours".getBytes(), nodes);
}


public AccountContractIndexStore getAccountContractIndexStore() {
return accountContractIndexStore;
}

public Set<Node> readNeighbours() {
return this.peersStore.get("neighbours".getBytes());
}
Expand Down