Transaction { public byte[] getContractAddress() { if (!isContractCreation()) return null; return HashUtil.calcNewAddr(this.getSender(), this.getNonce()); } Transaction(byte[] rawData);  Transaction(byte[] nonce, byte[] gasPrice, byte[] gasLimit, byte[] receiveAddress, byte[] value, byte[] data,
                       Integer chainId);  Transaction(byte[] nonce, byte[] gasPrice, byte[] gasLimit, byte[] receiveAddress, byte[] value, byte[] data);  Transaction(byte[] nonce, byte[] gasPrice, byte[] gasLimit, byte[] receiveAddress, byte[] value, byte[] data,
                       byte[] r, byte[] s, byte v, Integer chainId);  Transaction(byte[] nonce, byte[] gasPrice, byte[] gasLimit, byte[] receiveAddress, byte[] value, byte[] data,
                       byte[] r, byte[] s, byte v); long transactionCost(BlockchainNetConfig config, Block block); synchronized void verify(); synchronized void rlpParse(); boolean isParsed(); byte[] getHash(); byte[] getRawHash(); byte[] getNonce(); boolean isValueTx(); byte[] getValue(); byte[] getReceiveAddress(); byte[] getGasPrice(); byte[] getGasLimit(); long nonZeroDataBytes(); long zeroDataBytes(); byte[] getData(); ECDSASignature getSignature(); byte[] getContractAddress(); boolean isContractCreation(); ECKey getKey(); synchronized byte[] getSender(); Integer getChainId(); void sign(byte[] privKeyBytes); void sign(ECKey key); @Override String toString(); String toString(int maxDataSize); byte[] getEncodedRaw(); synchronized byte[] getEncoded(); @Override int hashCode(); @Override boolean equals(Object obj); static Transaction createDefault(String to, BigInteger amount, BigInteger nonce); static Transaction createDefault(String to, BigInteger amount, BigInteger nonce, Integer chainId); static Transaction create(String to, BigInteger amount, BigInteger nonce, BigInteger gasPrice, BigInteger gasLimit); static Transaction create(String to, BigInteger amount, BigInteger nonce, BigInteger gasPrice,
                                     BigInteger gasLimit, Integer chainId); static final int HASH_LENGTH; static final int ADDRESS_LENGTH; static final MemSizeEstimator<Transaction> MemEstimator; }
@Test public void multiSuicideTest() throws IOException, InterruptedException { String contract = "pragma solidity ^0.4.3;" + "contract PsychoKiller {" + " function () payable {}" + " function homicide() {" + " suicide(msg.sender);" + " }" + " function multipleHomocide() {" + " PsychoKiller k = this;" + " k.homicide.gas(10000)();" + " k.homicide.gas(10000)();" + " k.homicide.gas(10000)();" + " k.homicide.gas(10000)();" + " }" + "}"; SolidityCompiler.Result res = SolidityCompiler.compile( contract.getBytes(), true, SolidityCompiler.Options.ABI, SolidityCompiler.Options.BIN); logger.info(res.errors); CompilationResult cres = CompilationResult.parse(res.output); BlockchainImpl blockchain = ImportLightTest.createBlockchain(GenesisLoader.loadGenesis( getClass().getResourceAsStream("/genesis/genesis-light.json"))); ECKey sender = ECKey.fromPrivate(Hex.decode("3ec771c31cac8c0dba77a69e503765701d3c2bb62435888d4ffa38fed60c445c")).compress(); logger.info("address: " + Hex.toHexString(sender.getAddress())); if (cres.getContract("PsychoKiller") != null) { Transaction tx = createTx(blockchain, sender, new byte[0], Hex.decode(cres.getContract("PsychoKiller").bin)); executeTransaction(blockchain, tx); byte[] contractAddress = tx.getContractAddress(); CallTransaction.Contract contract1 = new CallTransaction.Contract(cres.getContract("PsychoKiller").abi); byte[] callData = contract1.getByName("multipleHomocide").encode(); Transaction tx1 = createTx(blockchain, sender, contractAddress, callData, 0l); ProgramResult programResult = executeTransaction(blockchain, tx1).getResult(); Assert.assertEquals(24000, programResult.getFutureRefund()); } else { Assert.fail(); } }