| 7873 | } |
| 7874 | |
| 7875 | bool ByteCodeExec::processingResults(ByteCodeExecResult& resultBCE){ |
| 7876 | for(size_t i = 0; i < result.size(); i++){ |
| 7877 | uint64_t gasUsed = (uint64_t) result[i].execRes.gasUsed; |
| 7878 | if(result[i].execRes.excepted != dev::eth::TransactionException::None){ |
| 7879 | if(txs[i].value() > 0){ |
| 7880 | CMutableTransaction tx; |
| 7881 | tx.vin.push_back(CTxIn(h256Touint(txs[i].getHashWith()), txs[i].getNVout(), CScript() << OP_SPEND)); |
| 7882 | CScript script(CScript() << OP_DUP << OP_HASH160 << txs[i].sender().asBytes() << OP_EQUALVERIFY << OP_CHECKSIG); |
| 7883 | tx.vout.push_back(CTxOut(CAmount(txs[i].value()), script)); |
| 7884 | resultBCE.valueTransfers.push_back(CTransaction(tx)); |
| 7885 | } |
| 7886 | resultBCE.usedGas += gasUsed; |
| 7887 | } else { |
| 7888 | if(txs[i].gas() > UINT64_MAX || |
| 7889 | result[i].execRes.gasUsed > UINT64_MAX || |
| 7890 | txs[i].gasPrice() > UINT64_MAX){ |
| 7891 | return false; |
| 7892 | } |
| 7893 | uint64_t gas = (uint64_t) txs[i].gas(); |
| 7894 | uint64_t gasPrice = (uint64_t) txs[i].gasPrice(); |
| 7895 | |
| 7896 | resultBCE.usedGas += gasUsed; |
| 7897 | int64_t amount = (gas - gasUsed) * gasPrice; |
| 7898 | if(amount < 0){ |
| 7899 | return false; |
| 7900 | } |
| 7901 | if(amount > 0){ |
| 7902 | CScript script(CScript() << OP_DUP << OP_HASH160 << txs[i].sender().asBytes() << OP_EQUALVERIFY << OP_CHECKSIG); |
| 7903 | resultBCE.refundOutputs.push_back(CTxOut(amount, script)); |
| 7904 | resultBCE.refundSender += amount; |
| 7905 | } |
| 7906 | } |
| 7907 | if(result[i].tx != CTransaction()){ |
| 7908 | resultBCE.valueTransfers.push_back(result[i].tx); |
| 7909 | } |
| 7910 | } |
| 7911 | return true; |
| 7912 | } |
| 7913 | |
| 7914 | dev::eth::EnvInfo ByteCodeExec::BuildEVMEnvironment(){ |
| 7915 | dev::eth::EnvInfo env; |
no test coverage detected