diff --git a/src/main/java/org/tron/common/application/ApplicationFactory.java b/src/main/java/org/tron/common/application/ApplicationFactory.java
index 319bb5e8bb6..7c0146afc37 100644
--- a/src/main/java/org/tron/common/application/ApplicationFactory.java
+++ b/src/main/java/org/tron/common/application/ApplicationFactory.java
@@ -15,22 +15,10 @@
package org.tron.common.application;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
import org.springframework.context.ApplicationContext;
public class ApplicationFactory {
- /**
- * Build a Guice instance.
- *
- * @return Guice
- */
- public Injector buildGuice() {
- return Guice.createInjector(
- new Module());
- }
-
/**
* Build a new application.
*/
diff --git a/src/main/java/org/tron/common/application/Module.java b/src/main/java/org/tron/common/application/Module.java
deleted file mode 100644
index 5b50d9173b4..00000000000
--- a/src/main/java/org/tron/common/application/Module.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * java-tron is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * java-tron is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package org.tron.common.application;
-
-import static org.tron.core.Constant.BLOCK_DB_NAME;
-import static org.tron.core.Constant.TRANSACTION_DB_NAME;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.Singleton;
-import javax.inject.Named;
-import org.tron.common.storage.leveldb.LevelDbDataSourceImpl;
-import org.tron.core.config.args.Args;
-
-public class Module extends AbstractModule {
-
- @Override
- protected void configure() {
-
- }
-
- /**
- * build transaction database.
- */
- @Provides
- @Singleton
- @Named("transaction")
- public LevelDbDataSourceImpl buildTransactionDb() {
- LevelDbDataSourceImpl db = new LevelDbDataSourceImpl(Args.getInstance().getOutputDirectory(),
- TRANSACTION_DB_NAME);
- db.initDB();
- return db;
- }
-
- /**
- * build block database.
- */
- @Provides
- @Singleton
- @Named("block")
- public LevelDbDataSourceImpl buildBlockDb() {
- LevelDbDataSourceImpl db = new LevelDbDataSourceImpl(Args.getInstance().getOutputDirectory(),
- BLOCK_DB_NAME);
- db.initDB();
- return db;
- }
-}
diff --git a/src/main/java/org/tron/core/SpendableOutputs.java b/src/main/java/org/tron/core/SpendableOutputs.java
deleted file mode 100644
index a8c83194c6d..00000000000
--- a/src/main/java/org/tron/core/SpendableOutputs.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * java-tron is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * java-tron is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package org.tron.core;
-
-import java.util.HashMap;
-
-public class SpendableOutputs {
- private long amount;
- private HashMap unspentOutputs = null;
-
- public HashMap getUnspentOutputs() {
- return unspentOutputs;
- }
-
- public void setUnspentOutputs(HashMap unspentOutputs) {
- this.unspentOutputs = unspentOutputs;
- }
-
- public long getAmount() {
- return amount;
- }
-
- public void setAmount(long amount) {
- this.amount = amount;
- }
-}
diff --git a/src/main/java/org/tron/core/db/Manager.java b/src/main/java/org/tron/core/db/Manager.java
index 80ebc999643..c124ec1f847 100644
--- a/src/main/java/org/tron/core/db/Manager.java
+++ b/src/main/java/org/tron/core/db/Manager.java
@@ -96,8 +96,6 @@ public class Manager {
@Autowired
private BlockStore blockStore;
@Autowired
- private UtxoStore utxoStore;
- @Autowired
private WitnessStore witnessStore;
@Autowired
private AssetIssueStore assetIssueStore;
@@ -1205,14 +1203,6 @@ private void setBlockStore(final BlockStore blockStore) {
this.blockStore = blockStore;
}
- public UtxoStore getUtxoStore() {
- return this.utxoStore;
- }
-
- private void setUtxoStore(final UtxoStore utxoStore) {
- this.utxoStore = utxoStore;
- }
-
/**
* process block.
*/
@@ -1415,7 +1405,6 @@ public void closeAllStore() {
closeOneStore(assetIssueStore);
closeOneStore(dynamicPropertiesStore);
closeOneStore(transactionStore);
- closeOneStore(utxoStore);
closeOneStore(codeStore);
closeOneStore(contractStore);
closeOneStore(storageRowStore);
diff --git a/src/main/java/org/tron/core/db/UtxoStore.java b/src/main/java/org/tron/core/db/UtxoStore.java
deleted file mode 100755
index d56579d0ef5..00000000000
--- a/src/main/java/org/tron/core/db/UtxoStore.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * java-tron is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * java-tron is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-
-package org.tron.core.db;
-
-import com.google.protobuf.InvalidProtocolBufferException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Collectors;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.ArrayUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-import org.tron.common.crypto.ECKey;
-import org.tron.common.utils.ByteArray;
-import org.tron.core.SpendableOutputs;
-import org.tron.protos.Protocol.TXOutput;
-import org.tron.protos.Protocol.TXOutputs;
-
-@Slf4j
-@Component
-public class UtxoStore extends TronDatabase {
-
- @Autowired
- private UtxoStore(@Value("utxo") String dbName) {
- super(dbName);
- }
-
-
- public byte[] find(byte[] key) {
- return dbSource.getData(key);
- }
-
-
- public Set getKeys() {
- return dbSource.allKeys();
- }
-
- /**
- * save utxo.
- */
- public void saveUtxo(byte[] utxoKey, byte[] utxoData) {
- dbSource.putData(utxoKey, utxoData);
- }
-
- /**
- * Find spendable outputs.
- */
- public SpendableOutputs findSpendableOutputs(byte[] pubKeyHash, long amount) {
- SpendableOutputs spendableOutputs = new SpendableOutputs();
- HashMap unspentOutputs = new HashMap<>();
- long accumulated = 0L;
-
- for (byte[] key : getDbSource().allKeys()) {
- try {
- TXOutputs txOutputs = TXOutputs.parseFrom(getDbSource().getData(key));
- String keyToHexString = ByteArray.toHexString(key);
-
- for (int i = 0, len = txOutputs.getOutputsCount(); i < len; i++) {
- TXOutput txOutput = txOutputs.getOutputs(i);
- if (ByteArray.toHexString(ECKey.computeAddress(pubKeyHash))
- .equals(ByteArray.toHexString(txOutput.getPubKeyHash().toByteArray()))
- && accumulated < amount) {
-
- accumulated += txOutput.getValue();
- long[] v = ArrayUtils.nullToEmpty(unspentOutputs.get(keyToHexString));
- unspentOutputs.put(keyToHexString, ArrayUtils.add(v, i));
- }
- }
- } catch (InvalidProtocolBufferException e) {
- logger.debug(e.getMessage(), e);
- }
- }
-
- spendableOutputs.setAmount(accumulated);
- spendableOutputs.setUnspentOutputs(unspentOutputs);
-
- return spendableOutputs;
- }
-
- /**
- * Find related UTXOs.
- */
- public ArrayList findUtxo(byte[] address) {
- return getDbSource().allKeys().stream()
- .map(key -> {
- try {
- return TXOutputs.parseFrom(getDbSource().getData(key));
- } catch (InvalidProtocolBufferException e) {
- logger.debug(e.getMessage(), e);
- return null;
- }
- })
- .filter(Objects::nonNull)
- .map(TXOutputs::getOutputsList)
- .flatMap(List::stream)
- .filter(txOutput -> ByteArray.toHexString(ECKey.computeAddress(address))
- .equals(ByteArray.toHexString(txOutput.getPubKeyHash().toByteArray())))
- .collect(Collectors.toCollection(ArrayList::new));
- }
-
- @Override
- public void put(byte[] key, Object item) {
-
- }
-
- @Override
- public void delete(byte[] key) {
-
- }
-
- @Override
- public Object get(byte[] key) {
- return null;
- }
-
- @Override
- public boolean has(byte[] key) {
- return false;
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/org/tron/core/events/BlockchainListener.java b/src/main/java/org/tron/core/events/BlockchainListener.java
deleted file mode 100644
index 3562702b411..00000000000
--- a/src/main/java/org/tron/core/events/BlockchainListener.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * java-tron is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * java-tron is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package org.tron.core.events;
-
-import org.tron.protos.Protocol.Block;
-
-public interface BlockchainListener {
-
- /**
- * New block added to blockchain.
- */
- void addBlock(Block block);
-
- /**
- * Genesis block added to blockchain.
- */
- void addGenesisBlock(Block block);
-}
diff --git a/src/main/java/org/tron/core/facade/TronBlockChain.java b/src/main/java/org/tron/core/facade/TronBlockChain.java
deleted file mode 100644
index c03c802584e..00000000000
--- a/src/main/java/org/tron/core/facade/TronBlockChain.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * java-tron is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * java-tron is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package org.tron.core.facade;
-
-import org.tron.protos.Protocol.Block;
-
-public interface TronBlockChain {
-
- /**
- * last added block from blockchain.
- */
- Block getBestBlock();
-}