diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/JsonRpcServer.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/JsonRpcServer.java index 8e2beac9..a0ca7d75 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/JsonRpcServer.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/JsonRpcServer.java @@ -37,6 +37,8 @@ import static io.netty.handler.codec.http.HttpHeaders.Names.*; import org.ethereum.android.jsonrpc.method.*; +import java.net.InetAddress; + public final class JsonRpcServer { @@ -123,8 +125,8 @@ public final class JsonRpcServer { try { ServerBootstrap b = new ServerBootstrap(); b.option(ChannelOption.SO_BACKLOG, 1024); -// b.localAddress(InetAddress.getLocalHost(), PORT); - b.localAddress(PORT); + b.localAddress(InetAddress.getLocalHost(), PORT); +// b.localAddress(PORT); b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .childHandler(new JsonRpcServerInitializer()); diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/JsonRpcServerMethod.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/JsonRpcServerMethod.java index dbe755f0..11a4a4fe 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/JsonRpcServerMethod.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/JsonRpcServerMethod.java @@ -204,7 +204,7 @@ public abstract class JsonRpcServerMethod implements RequestHandler { i = 0; for (Transaction transaction : block.getTransactionsList()) { if (detailed) { - JSONObject tx = transactionToJS(transaction); + JSONObject tx = transactionToJS(block, transaction); tx.put("transactionIndex", "0x" + Integer.toHexString(i)); tx.put("blockHash", "0x" + Hex.toHexString(block.getHash())); tx.put("blockNumber", "0x" + Long.toHexString(block.getNumber())); @@ -216,7 +216,6 @@ public abstract class JsonRpcServerMethod implements RequestHandler { } res.put("transactions", transactionsJA); - //TODO: ask if I correctly get uncle's hash (takes form -core right now) JSONArray unclesJA = new JSONArray(); for (BlockHeader uncle : block.getUncleList()) { unclesJA.add("0x" + Hex.toHexString(HashUtil.sha3(uncle.getEncoded()))); @@ -226,7 +225,7 @@ public abstract class JsonRpcServerMethod implements RequestHandler { return res; } - protected JSONObject transactionToJS (Transaction transaction) { + protected JSONObject transactionToJS (Block block, Transaction transaction) { JSONObject res = new JSONObject(); res.put("hash", "0x" + Hex.toHexString(transaction.getHash())); @@ -245,13 +244,22 @@ public abstract class JsonRpcServerMethod implements RequestHandler { res.put("input", "0x" + Hex.toHexString(transaction.getData())); -/* - No way to get this data from inside of transaction. - TODO: Ask roman to include it into transaction class. - res.put("transactionIndex", "0x" + ""); - res.put("blockHash", "0x" + ""); - res.put("blockNumber", "0x" + ""); -*/ + if (block == null) { + res.put("transactionIndex", null); + res.put("blockHash", null); + res.put("blockNumber", null); + } else { + long txi = 0; + for (Transaction tx : block.getTransactionsList()) { + if (Arrays.equals(tx.getHash(), transaction.getHash())) + break; + txi++; + } + res.put("transactionIndex", "0x" + Long.toHexString(txi)); + res.put("blockHash", "0x" + Hex.toHexString(block.getHash())); + res.put("blockNumber", "0x" + Long.toHexString(block.getNumber())); + } + return res; } } \ No newline at end of file diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/filter/FilterLog.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/filter/FilterLog.java index a2c2c09b..8bd2e37a 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/filter/FilterLog.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/filter/FilterLog.java @@ -13,20 +13,19 @@ import org.spongycastle.util.encoders.Hex; import java.util.ArrayList; import java.util.Arrays; -/* -Right now LogInfo not contains information about Transaction and Transaction not have information about block. -TODO: talk to Roman about create links between LogInfo and Transaction and between Transaction and Block. -*/ public class FilterLog extends FilterBase { - private ArrayList logs = new ArrayList(); + private ArrayList logs = new ArrayList(); long blockFrom; long blockTo; ArrayList addresses = new ArrayList<>(); ArrayList topics = new ArrayList<>(); + private Ethereum ethereum; + public FilterLog (Ethereum ethereum, JSONObject data) { + this.ethereum = ethereum; blockFrom = ethereum.getBlockchain().getBestBlock().getNumber(); if (data.containsKey("fromBlock") && !((String)data.get("fromBlock")).equals("")) { String fromS = (String)data.get("fromBlock"); @@ -74,16 +73,17 @@ public class FilterLog extends FilterBase { } } -/* -TODO: Right now Bloom from -core can be used only to check total mach of 2 same class objects. Will be nice to have possibility to check contains. -*/ public void processEvent(Object data) { - if (data instanceof LogInfo) { + if (data instanceof FilterLogData) { synchronized (logs) { - LogInfo li = (LogInfo)data; - //TODO: check if li inside blockFrom - blockTo + FilterLogData li = (FilterLogData)data; + if ((blockFrom >= 0 && li.block.getNumber() < blockFrom) || (blockTo >= 0 && li.block.getNumber() > blockTo)) + return; - if (checkLogInfo(li)) +/* +TODO: Roman must implement Bloom contain. When it will be done - we can use just Bloom. +*/ + if (checkLogInfo(li.li)) logs.add(li); } } @@ -93,7 +93,7 @@ TODO: Right now Bloom from -core can be used only to check total mach of 2 same updateLastRequest(); JSONArray res = new JSONArray(); synchronized (logs) { - for(LogInfo item : logs) { + for(FilterLogData item : logs) { res.add(logInfoToJS(item)); } logs.clear(); @@ -104,7 +104,6 @@ TODO: Right now Bloom from -core can be used only to check total mach of 2 same public JSONArray toJS(Ethereum ethereum) { JSONArray res = new JSONArray(); -// Process mined blocks if (blockFrom >= 0) { long i = blockFrom; while (true) { @@ -116,7 +115,7 @@ TODO: Right now Bloom from -core can be used only to check total mach of 2 same if (txr != null) { for (LogInfo li : txr.getLogInfoList()) { if (checkLogInfo(li)) - res.add(logInfoToJS(li)); + res.add(logInfoToJS(new FilterLogData(block, txr, li))); } } } @@ -124,16 +123,13 @@ TODO: Right now Bloom from -core can be used only to check total mach of 2 same } } -/* -Process pending transactions. But not sure if BlockChain can return TransactionReceipt for pending transaction. -*/ if (blockFrom < 0 || blockTo < 0) { for (Transaction tx : ethereum.getPendingTransactions()) { TransactionReceipt txr = ethereum.getBlockchain().getTransactionReceiptByHash(tx.getHash()); if (txr != null) { for (LogInfo li : txr.getLogInfoList()) { if (checkLogInfo(li)) - res.add(logInfoToJS(li)); + res.add(logInfoToJS(new FilterLogData(null, txr, li))); } } } @@ -171,29 +167,63 @@ Process pending transactions. But not sure if BlockChain can return TransactionR return true; } - private JSONObject logInfoToJS(LogInfo li) { + private JSONObject logInfoToJS(FilterLogData data) { JSONObject res = new JSONObject(); + if (data.block == null) { + res.put("type", "pending"); + res.put("logIndex", null); + res.put("transactionIndex", null); + res.put("transactionHash", null); + res.put("blockHash", null); + res.put("blockNumber", null); + } else { + res.put("type", "mined"); + long txi = 0; + long lii = 0; /* -TODO: check here if log's transaction / block mined or pending. +TODO: for me it's a little strange way. */ - res.put("type", "pending"); - res.put("logIndex", null); - res.put("transactionIndex", null); - res.put("transactionHash", null); - res.put("blockHash", null); - res.put("blockNumber", null); + for (Transaction tx : data.block.getTransactionsList()) { + for (LogInfo li : ethereum.getBlockchain().getTransactionReceiptByHash(tx.getHash()).getLogInfoList()) { + if (li.getBloom().equals(data.li.getBloom())) + break; + lii++; + } + if (Arrays.equals(tx.getHash(), data.txr.getTransaction().getHash())) { + break; + } + txi++; + } + res.put("logIndex", "0x" + Long.toHexString(lii)); + res.put("transactionIndex", "0x" + Long.toHexString(txi)); + res.put("transactionHash", "0x" + Hex.toHexString(data.txr.getTransaction().getHash())); + res.put("blockHash", "0x" + Hex.toHexString(data.block.getHash())); + res.put("blockNumber", "0x" + Long.toHexString(data.block.getNumber())); + } - res.put("address", Hex.toHexString(li.getAddress())); + res.put("address", "0x" + Hex.toHexString(data.li.getAddress())); - res.put("data", Hex.toHexString(li.getData())); + res.put("data", "0x" + Hex.toHexString(data.li.getData())); JSONArray topics = new JSONArray(); - for (DataWord topic : li.getTopics()) { - topics.add(Hex.toHexString(topic.getData())); + for (DataWord topic : data.li.getTopics()) { + topics.add("0x" + Hex.toHexString(topic.getData())); } res.put("topics", topics); return res; } + + public static class FilterLogData { + public Block block; + public TransactionReceipt txr; + public LogInfo li; + + public FilterLogData( Block block, TransactionReceipt txr, LogInfo li) { + this.block = block; + this.txr = txr; + this.li = li; + } + } } diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/filter/FilterManager.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/filter/FilterManager.java index 7aac4a59..0887a991 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/filter/FilterManager.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/filter/FilterManager.java @@ -7,6 +7,7 @@ import org.ethereum.core.Transaction; import org.ethereum.core.TransactionReceipt; import org.ethereum.facade.Ethereum; import org.ethereum.listener.EthereumListenerAdapter; +import org.ethereum.vm.LogInfo; import java.util.Hashtable; import java.util.List; @@ -55,6 +56,9 @@ public class FilterManager extends EthereumListenerAdapter { public void onBlock(Block block, List receipts) { processEvent(block); for(TransactionReceipt tx : receipts) { + for (LogInfo li : tx.getLogInfoList()) { + processEvent(new FilterLog.FilterLogData(block, tx, li)); + } processEvent(tx.getTransaction()); } } diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_coinbase.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_coinbase.java index 599bd821..0b0d013e 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_coinbase.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_coinbase.java @@ -8,12 +8,8 @@ import org.ethereum.core.*; import org.spongycastle.util.encoders.Hex; /* -Present big issue - current ethereumj-core not have coinbase "functionality". -On each app start - it create 2 addresses: "cow", coinbase.secret ("monkey") --- WorldManager.java -> init -Also because not present mining functionality - no wat to identify what address will be coinbase (mining success payment place to) -TODO: change this after fix in ethereumj-core +TODO: -core not handle mining so coinbase not present in it. Right now returned second address from Wallet. Must be changed in app where implemented mining */ - public class eth_coinbase extends JsonRpcServerMethod { public eth_coinbase (Ethereum ethereum) { diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_compileSerpent.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_compileSerpent.java index fbf88f46..defb80b8 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_compileSerpent.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_compileSerpent.java @@ -13,8 +13,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; /* -Example taken from -studio. Not sure if we must call encodeMachineCodeForVMRun in end -TODO: get advice from Roman about encodeMachineCodeForVMRun +TODO: Serpent will be depricated in future. */ public class eth_compileSerpent extends JsonRpcServerMethod { @@ -41,7 +40,7 @@ public class eth_compileSerpent extends JsonRpcServerMethod { } else { asmResult = SerpentCompiler.compile(code); machineCode = SerpentCompiler.compileAssemblyToMachine(asmResult); -// machineCode = SerpentCompiler.encodeMachineCodeForVMRun(machineCode, null); + machineCode = SerpentCompiler.encodeMachineCodeForVMRun(machineCode, null); } } catch (Throwable th) { return new JSONRPC2Response(JSONRPC2Error.INTERNAL_ERROR, req.getID()); diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_compileSolidity.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_compileSolidity.java index 8f68be9b..8d44c298 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_compileSolidity.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_compileSolidity.java @@ -10,7 +10,7 @@ import java.math.BigInteger; import java.util.List; /* -TODO: -core not have solidity compiler +ATODO: -core not have solidity compiler. Need try to use cpp solidity compiler using JNI */ public class eth_compileSolidity extends JsonRpcServerMethod { diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getBlockByHash.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getBlockByHash.java index 252ffe4c..b5a0636f 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getBlockByHash.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getBlockByHash.java @@ -10,10 +10,6 @@ import org.spongycastle.util.encoders.Hex; import java.math.BigInteger; import java.util.List; -/* -By specification this method can receive hash of pending block but from -core it's not possible. -TODO: get advice from Roman about pending block -*/ public class eth_getBlockByHash extends JsonRpcServerMethod { public eth_getBlockByHash (Ethereum ethereum) { diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getBlockByNumber.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getBlockByNumber.java index e2352088..e7ac5763 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getBlockByNumber.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getBlockByNumber.java @@ -10,10 +10,6 @@ import org.spongycastle.util.encoders.Hex; import java.math.BigInteger; import java.util.List; -/* -By specification this method can receive number of pending block but from -core it's not possible. -TODO: get advice from Roman about pending block -*/ public class eth_getBlockByNumber extends JsonRpcServerMethod { public eth_getBlockByNumber (Ethereum ethereum) { @@ -33,8 +29,9 @@ public class eth_getBlockByNumber extends JsonRpcServerMethod { if (blockNumber == -1) { blockNumber = ethereum.getBlockchain().getBestBlock().getNumber(); } - // TODO: here we must load pending block but -core not "group" it. + if (blockNumber == -2) { + return new JSONRPC2Response(null, req.getID()); } Block block = ethereum.getBlockchain().getBlockByNumber(blockNumber); diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getCode.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getCode.java index d6135e46..8635e532 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getCode.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getCode.java @@ -7,10 +7,6 @@ import org.ethereum.facade.Ethereum; import org.spongycastle.util.encoders.Hex; import java.util.List; -/* -Not sure if pending can have code. Also code by itself related to repository not very clear for me. -TODO: ask Roman advice for this method. -*/ public class eth_getCode extends JsonRpcServerMethod { public eth_getCode (Ethereum ethereum) { diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getCompilers.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getCompilers.java index a785c787..d6c72224 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getCompilers.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getCompilers.java @@ -16,7 +16,9 @@ public class eth_getCompilers extends JsonRpcServerMethod { ArrayList tmp = new ArrayList(); tmp.add("serpent"); - //TODO: add lll and solidity when they will be implemented in -core +/* +TODO: add lll and solidity when we find good libs for them. They not planned to be implemented in -core. +*/ JSONRPC2Response res = new JSONRPC2Response(tmp, req.getID()); return res; diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getStorageAt.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getStorageAt.java index dc45f462..8130dd97 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getStorageAt.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getStorageAt.java @@ -9,10 +9,6 @@ import org.ethereum.vm.DataWord; import org.spongycastle.util.encoders.Hex; import java.util.List; -/* -As I see getStorageValue not check Pending Transactions. -TODO: ask roman advice for this method. -*/ public class eth_getStorageAt extends JsonRpcServerMethod { public eth_getStorageAt(Ethereum ethereum) { super(ethereum); } diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getTransactionByBlockHashAndIndex.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getTransactionByBlockHashAndIndex.java index 7f0bcdd0..57663606 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getTransactionByBlockHashAndIndex.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getTransactionByBlockHashAndIndex.java @@ -36,7 +36,7 @@ public class eth_getTransactionByBlockHashAndIndex extends JsonRpcServerMethod { if (block.getTransactionsList().size() <= index) return new JSONRPC2Response(null, req.getID()); - JSONObject tx = transactionToJS(block.getTransactionsList().get(index)); + JSONObject tx = transactionToJS(block, block.getTransactionsList().get(index)); tx.put("transactionIndex", "0x" + Integer.toHexString(index)); tx.put("blockHash", "0x" + Hex.toHexString(block.getHash())); tx.put("blockNumber", "0x" + Long.toHexString(block.getNumber())); diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getTransactionByBlockNumberAndIndex.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getTransactionByBlockNumberAndIndex.java index 260f0293..f7672211 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getTransactionByBlockNumberAndIndex.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getTransactionByBlockNumberAndIndex.java @@ -8,6 +8,7 @@ import net.minidev.json.JSONObject; import org.ethereum.android.jsonrpc.JsonRpcServerMethod; import org.ethereum.core.AccountState; import org.ethereum.core.Block; +import org.ethereum.core.Transaction; import org.ethereum.facade.Ethereum; import org.spongycastle.util.encoders.Hex; import java.math.BigInteger; @@ -32,23 +33,22 @@ public class eth_getTransactionByBlockNumberAndIndex extends JsonRpcServerMethod if (blockNumber == -1) { blockNumber = ethereum.getBlockchain().getBestBlock().getNumber(); } - // TODO: here we must load pending block but -core not "group" it. + + Block block = null; + JSONObject tx = null; if (blockNumber == -2) { + if (ethereum.getPendingTransactions().size() <= index) + return new JSONRPC2Response(null, req.getID()); + tx = transactionToJS(null, (Transaction)ethereum.getPendingTransactions().toArray()[index]); + } else { + block = ethereum.getBlockchain().getBlockByNumber(blockNumber); + if (block == null) + return new JSONRPC2Response(null, req.getID()); + if (block.getTransactionsList().size() <= index) + return new JSONRPC2Response(null, req.getID()); + tx = transactionToJS(block, block.getTransactionsList().get(index)); } - Block block = ethereum.getBlockchain().getBlockByNumber(blockNumber); - - if (block == null) - return new JSONRPC2Response(null, req.getID()); - - if (block.getTransactionsList().size() <= index) - return new JSONRPC2Response(null, req.getID()); - - JSONObject tx = transactionToJS(block.getTransactionsList().get(index)); - tx.put("transactionIndex", "0x" + Integer.toHexString(index)); - tx.put("blockHash", "0x" + Hex.toHexString(block.getHash())); - tx.put("blockNumber", "0x" + Long.toHexString(block.getNumber())); - JSONRPC2Response res = new JSONRPC2Response(tx, req.getID()); return res; } diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getTransactionByHash.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getTransactionByHash.java index b7aa3485..2cd45dfc 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getTransactionByHash.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getTransactionByHash.java @@ -7,6 +7,9 @@ import org.ethereum.core.TransactionReceipt; import org.ethereum.facade.Ethereum; import java.util.List; +/* +ATODO: talk with Adrian to get relation between Transaction and Block from db. +*/ public class eth_getTransactionByHash extends JsonRpcServerMethod { public eth_getTransactionByHash (Ethereum ethereum) { @@ -26,7 +29,7 @@ public class eth_getTransactionByHash extends JsonRpcServerMethod { if (transaction == null) return new JSONRPC2Response(null, req.getID()); - JSONRPC2Response res = new JSONRPC2Response(transactionToJS(transaction.getTransaction()), req.getID()); + JSONRPC2Response res = new JSONRPC2Response(transactionToJS(null, transaction.getTransaction()), req.getID()); return res; } diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getUncleByBlockHashAndIndex.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getUncleByBlockHashAndIndex.java index 86bb6656..0ddb0ba6 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getUncleByBlockHashAndIndex.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getUncleByBlockHashAndIndex.java @@ -31,7 +31,7 @@ public class eth_getUncleByBlockHashAndIndex extends JsonRpcServerMethod { if (block.getUncleList().size() <= index) return new JSONRPC2Response(null, req.getID()); - Block uncle = ethereum.getBlockchain().getBlockByHash(HashUtil.sha3(block.getUncleList().get(index).getEncoded())); + Block uncle = new Block(block.getUncleList().get(index), null, null); JSONRPC2Response res = new JSONRPC2Response(blockToJS(uncle, false), req.getID()); return res; diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getUncleByBlockNumberAndIndex.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getUncleByBlockNumberAndIndex.java index 6238dd9b..cc72ea61 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getUncleByBlockNumberAndIndex.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getUncleByBlockNumberAndIndex.java @@ -8,6 +8,7 @@ import org.ethereum.crypto.HashUtil; import org.ethereum.facade.Ethereum; import java.util.List; + public class eth_getUncleByBlockNumberAndIndex extends JsonRpcServerMethod { public eth_getUncleByBlockNumberAndIndex (Ethereum ethereum) { @@ -27,7 +28,7 @@ public class eth_getUncleByBlockNumberAndIndex extends JsonRpcServerMethod { if (blockNumber == -1) { blockNumber = ethereum.getBlockchain().getBestBlock().getNumber(); } - // TODO: here we must load pending block but -core not "group" it. + if (blockNumber == -2) { } @@ -39,7 +40,7 @@ public class eth_getUncleByBlockNumberAndIndex extends JsonRpcServerMethod { if (block.getUncleList().size() <= index) return new JSONRPC2Response(null, req.getID()); - Block uncle = ethereum.getBlockchain().getBlockByHash(HashUtil.sha3(block.getUncleList().get(index).getEncoded())); + Block uncle = new Block(block.getUncleList().get(index), null, null); JSONRPC2Response res = new JSONRPC2Response(blockToJS(uncle, false), req.getID()); return res; diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getWork.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getWork.java index 871908d8..8cd6d778 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getWork.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_getWork.java @@ -6,7 +6,7 @@ import org.ethereum.android.jsonrpc.JsonRpcServerMethod; import org.ethereum.facade.Ethereum; /* -TODO: right now -core not auto start mining so no way to get information about state +TODO: must be changed in app that implement mining */ public class eth_getWork extends JsonRpcServerMethod { diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_hashrate.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_hashrate.java index 6c461b66..48e3f704 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_hashrate.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_hashrate.java @@ -6,7 +6,7 @@ import org.ethereum.android.jsonrpc.JsonRpcServerMethod; import org.ethereum.facade.Ethereum; /* -TODO: right now -core not have "finished" mining architecture so not have hashrate +TODO: must be changed in app that implement mining */ public class eth_hashrate extends JsonRpcServerMethod { diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_mining.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_mining.java index e49686b0..ea09cb39 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_mining.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_mining.java @@ -6,7 +6,7 @@ import org.ethereum.android.jsonrpc.JsonRpcServerMethod; import org.ethereum.facade.Ethereum; /* -TODO: right now -core not auto start mining and also not have marker to identify if it's happening +TODO: must be changed in app that implement mining */ public class eth_mining extends JsonRpcServerMethod { diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_sendTransaction.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_sendTransaction.java index 30071b38..3423cc7e 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_sendTransaction.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_sendTransaction.java @@ -15,6 +15,10 @@ import java.util.concurrent.TimeUnit; import static org.ethereum.core.Denomination.SZABO; import static org.ethereum.config.SystemProperties.CONFIG; + +/* +TODO: get more information from Roman, he think about this right now about 20 - 32 result. +*/ public class eth_sendTransaction extends JsonRpcServerMethod { public eth_sendTransaction (Ethereum ethereum) { diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_submitWork.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_submitWork.java index 26de2cf8..d00b000c 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_submitWork.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/eth_submitWork.java @@ -9,7 +9,7 @@ import org.ethereum.facade.Ethereum; import java.util.List; /* -TODO: right now -core not auto start mining so no way to get information about state +TODO: must be changed in app that implement mining */ public class eth_submitWork extends JsonRpcServerMethod { diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/net_version.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/net_version.java index 5154f760..8ef96720 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/net_version.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/net_version.java @@ -6,7 +6,7 @@ import org.ethereum.android.jsonrpc.JsonRpcServerMethod; import org.ethereum.facade.Ethereum; /* -TODO: request go version how this must be identified. Cpp version just return "". +TODO: maybe in future AdminState will have information about this. */ public class net_version extends JsonRpcServerMethod { diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/shh_post.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/shh_post.java index 927cb2be..69b69ef1 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/shh_post.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/method/shh_post.java @@ -51,7 +51,7 @@ public class shh_post extends JsonRpcServerMethod { int ttl = jsToInt((String)obj.get("ttl")); - //TODO: +//TODO: implement after Adrian merge with dev JSONRPC2Response res = new JSONRPC2Response(JSONRPC2Error.METHOD_NOT_FOUND, req.getID()); return res; diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/whisper/Filter.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/whisper/Filter.java index c23217c8..be0d2999 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/whisper/Filter.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/whisper/Filter.java @@ -54,7 +54,7 @@ public class Filter { } public void processEvent(Object data) { - //TODO: parse incomming data when we will know what comes. +//TODO: parse incomming data when we will know what comes. } public JSONArray toJS() { diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/whisper/FilterManager.java b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/whisper/FilterManager.java index ebc60443..9089f508 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/whisper/FilterManager.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/jsonrpc/whisper/FilterManager.java @@ -11,7 +11,7 @@ import java.util.TimerTask; import java.util.concurrent.TimeUnit; /* -This class must receive notification from -core about new whisper message. Right now I not see the way todo that. +This class must receive notification from -core about new whisper message. Right now I not see the way to do that. TODO: ask advice from Roman about how to send notification to this class. */ public class FilterManager {