ethereum / ethereumj

DEPRECATED! Java implementation of the Ethereum yellowpaper. For JSON-RPC and other client features check Ethereum Harmony
GNU Lesser General Public License v3.0
2.18k stars 1.1k forks source link

It is necessary? #1225

Closed chenjiaweiprimeledger closed 5 years ago

chenjiaweiprimeledger commented 5 years ago

1) org.ethereum.core.TransactionExecutor#create AccountState existingAddr = cacheTrack.getAccountState(newContractAddress); if (existingAddr != null && existingAddr.isContractExist(blockchainConfig)) { execError("Trying to create a contract with existing contract address: 0x" + toHexString(newContractAddress)); m_endGas = BigInteger.ZERO; return; }

existingAddr will not exists, because the nonce of the sender has been checked in org.ethereum.core.TransactionExecutor#init

2) org.ethereum.core.TransactionExecutor#create //In case of hashing collisions (for TCK tests only), check for any balance before createAccount() BigInteger oldBalance = track.getBalance(newContractAddress); cacheTrack.createAccount(tx.getContractAddress()); cacheTrack.addBalance(newContractAddress, oldBalance);

It is rude to transfer balance of same-address contract to the new contract ?

mkalinin commented 5 years ago
  1. Relates to https://github.com/ethereum/EIPs/issues/684
  2. Relates only to tests from #ethereum/tests repository, it hardly could happen on main or any other network.