diff --git a/app/src/main/java/org/ethereum/android_app/ConsoleFragment.java b/app/src/main/java/org/ethereum/android_app/ConsoleFragment.java index 008acf3b..ba65a772 100644 --- a/app/src/main/java/org/ethereum/android_app/ConsoleFragment.java +++ b/app/src/main/java/org/ethereum/android_app/ConsoleFragment.java @@ -2,6 +2,7 @@ package org.ethereum.android_app; import android.app.Activity; import android.os.Bundle; +import android.os.Handler; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.text.method.ScrollingMovementMethod; @@ -10,30 +11,25 @@ import android.view.View; import android.view.ViewGroup; import android.widget.TextView; -import org.ethereum.android.EthereumManager; -import org.ethereum.listener.EthereumListenerAdapter; public class ConsoleFragment extends Fragment implements FragmentInterface { - EthereumManager ethereumManager; private TextView console; - TextViewUpdater consoleUpdater = new TextViewUpdater(); + private final static int CONSOLE_LENGTH = 10000; + private final static int CONSOLE_REFRESH_MILLS = 1000 * 5; //5 sec - private class TextViewUpdater implements Runnable { + private Handler handler = new Handler(); - private String txt; + + private Runnable mRunnable = new Runnable() { @Override public void run() { - console.setText(txt); + console.setText(EthereumApplication.log); + handler.postDelayed(mRunnable, CONSOLE_REFRESH_MILLS); } - public void setText(String txt) { - - this.txt = txt; - } - - } + }; @Override public void onCreate(@Nullable Bundle savedInstanceState) { @@ -41,6 +37,18 @@ public class ConsoleFragment extends Fragment implements FragmentInterface { super.onCreate(savedInstanceState); } + @Override + public void onPause() { + super.onPause(); + handler.removeCallbacksAndMessages(null); + } + + @Override + public void onResume() { + super.onResume(); + handler.post(mRunnable); + } + @Override public void onAttach(Activity activity) { @@ -58,9 +66,8 @@ public class ConsoleFragment extends Fragment implements FragmentInterface { return view; } + @Override public void onMessage(String message) { - - consoleUpdater.setText(message); - ConsoleFragment.this.console.post(consoleUpdater); + System.out.println(message); } } \ No newline at end of file diff --git a/app/src/main/java/org/ethereum/android_app/EthereumApplication.java b/app/src/main/java/org/ethereum/android_app/EthereumApplication.java index 46a40233..9033052c 100644 --- a/app/src/main/java/org/ethereum/android_app/EthereumApplication.java +++ b/app/src/main/java/org/ethereum/android_app/EthereumApplication.java @@ -1,54 +1,172 @@ package org.ethereum.android_app; +import android.os.AsyncTask; +import android.os.Bundle; import android.os.Message; import android.support.multidex.MultiDexApplication; import org.ethereum.android.service.ConnectorHandler; +import org.ethereum.android.service.EthereumClientMessage; import org.ethereum.android.service.EthereumConnector; +import org.ethereum.android.service.events.BlockEventData; +import org.ethereum.android.service.events.EventData; +import org.ethereum.android.service.events.EventFlag; +import org.ethereum.android.service.events.MessageEventData; +import org.ethereum.android.service.events.PeerDisconnectEventData; +import org.ethereum.android.service.events.PendingTransactionsEventData; +import org.ethereum.android.service.events.TraceEventData; +import org.ethereum.android.service.events.VMTraceCreatedEventData; +import org.ethereum.net.p2p.HelloMessage; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.EnumSet; +import java.util.UUID; public class EthereumApplication extends MultiDexApplication implements ConnectorHandler { + private final static int CONSOLE_LENGTH = 10000; public static EthereumConnector ethereum = null; public static String log = ""; + public static String identifier = UUID.randomUUID().toString(); + static DateFormat formatter = new SimpleDateFormat("HH:mm:ss:SSS"); @Override public void onCreate() { super.onCreate(); if (ethereum == null) { ethereum = new EthereumConnector(this, EthereumService.class); - ethereum.registerHandler(this); - ethereum.bindService(); } + ethereum.registerHandler(this); + ethereum.bindService(); } @Override public void onTerminate() { + super.onTerminate(); ethereum.removeHandler(this); + ethereum.removeListener(identifier); ethereum.unbindService(); ethereum = null; } @Override public void onConnectorConnected() { + System.out.println("Connector connected"); + ethereum.addListener(identifier, EnumSet.allOf(EventFlag.class)); } @Override public void onConnectorDisconnected() { + } @Override public String getID() { - return "1"; + return identifier; + } + + protected class MessageProcessTask extends AsyncTask { + + Message message = null; + + public MessageProcessTask(Message message) { + + this.message = message; + } + + protected Void doInBackground(Void... args) { + + processMessage(message); + return null; + } + + protected void onPostExecute(Void results) { + + + } + } + + protected void processMessage(Message message) { + + Bundle data = message.getData(); + data.setClassLoader(EventFlag.class.getClassLoader()); + EventFlag event = (EventFlag)data.getSerializable("event"); + EventData eventData; + MessageEventData messageEventData; + switch(event) { + case EVENT_BLOCK: + BlockEventData blockEventData = data.getParcelable("data"); + addLogEntry(blockEventData.registeredTime, "Added block with " + blockEventData.receipts.size() + " transaction receipts."); + break; + case EVENT_HANDSHAKE_PEER: + messageEventData = data.getParcelable("data"); + addLogEntry(messageEventData.registeredTime, "Peer " + new HelloMessage(messageEventData.message).getPeerId() + " said hello"); + break; + case EVENT_NO_CONNECTIONS: + eventData = data.getParcelable("data"); + addLogEntry(eventData.registeredTime, "No connections"); + break; + case EVENT_PEER_DISCONNECT: + PeerDisconnectEventData peerDisconnectEventData = data.getParcelable("data"); + addLogEntry(peerDisconnectEventData.registeredTime, "Peer " + peerDisconnectEventData.host + ":" + peerDisconnectEventData.port + " disconnected."); + break; + case EVENT_PENDING_TRANSACTIONS_RECEIVED: + PendingTransactionsEventData pendingTransactionsEventData = data.getParcelable("data"); + addLogEntry(pendingTransactionsEventData.registeredTime, "Received " + pendingTransactionsEventData.transactions.size() + " pending transactions"); + break; + case EVENT_RECEIVE_MESSAGE: + messageEventData = data.getParcelable("data"); + addLogEntry(messageEventData.registeredTime, "Received message: " + messageEventData.messageClass.getName()); + break; + case EVENT_SEND_MESSAGE: + messageEventData = data.getParcelable("data"); + addLogEntry(messageEventData.registeredTime, "Sent message: " + messageEventData.messageClass.getName()); + break; + case EVENT_SYNC_DONE: + eventData = data.getParcelable("data"); + addLogEntry(eventData.registeredTime, "Sync done"); + break; + case EVENT_VM_TRACE_CREATED: + VMTraceCreatedEventData vmTraceCreatedEventData = data.getParcelable("data"); + addLogEntry(vmTraceCreatedEventData.registeredTime, "CM trace created: " + vmTraceCreatedEventData.transactionHash + " - " + vmTraceCreatedEventData.trace); + break; + case EVENT_TRACE: + TraceEventData traceEventData = data.getParcelable("data"); + addLogEntry(traceEventData.registeredTime, traceEventData.message); + break; + } } @Override - public boolean handleMessage(Message message) { + public boolean handleMessage(final Message message) { - System.out.println(message.toString()); - return true; + boolean isClaimed = true; + switch(message.what) { + case EthereumClientMessage.MSG_EVENT: + Message messageCopy = new Message(); + messageCopy.copyFrom(message); + new MessageProcessTask(messageCopy).execute(); + break; + default: + isClaimed = false; + } + return isClaimed; + } + + protected void addLogEntry(long timestamp, String message) { + + Date date = new Date(timestamp); + + String logEntry = formatter.format(date) + " -> " + message + "\n\n"; + EthereumApplication.log += logEntry; + if (EthereumApplication.log.length() > CONSOLE_LENGTH) { + EthereumApplication.log = EthereumApplication.log.substring(CONSOLE_LENGTH); + } } } \ No newline at end of file diff --git a/app/src/main/java/org/ethereum/android_app/RemoteMainActivity.java b/app/src/main/java/org/ethereum/android_app/RemoteMainActivity.java index a5c7935a..a07147f4 100644 --- a/app/src/main/java/org/ethereum/android_app/RemoteMainActivity.java +++ b/app/src/main/java/org/ethereum/android_app/RemoteMainActivity.java @@ -1,43 +1,21 @@ package org.ethereum.android_app; -import android.os.Message; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; - -import org.ethereum.android.service.ConnectorHandler; -import org.ethereum.android.service.EthereumClientMessage; -import org.ethereum.android.service.events.BlockEventData; -import org.ethereum.android.service.events.EventData; -import org.ethereum.android.service.events.EventFlag; -import org.ethereum.android.service.events.MessageEventData; -import org.ethereum.android.service.events.PeerDisconnectEventData; -import org.ethereum.android.service.events.PendingTransactionsEventData; -import org.ethereum.android.service.events.TraceEventData; -import org.ethereum.android.service.events.VMTraceCreatedEventData; -import org.ethereum.config.SystemProperties; -import org.ethereum.net.p2p.HelloMessage; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Date; -import java.util.EnumSet; -import java.util.UUID; -public class RemoteMainActivity extends ActionBarActivity implements ActivityInterface, ConnectorHandler { +public class RemoteMainActivity extends ActionBarActivity implements ActivityInterface { private Toolbar toolbar; private ViewPager viewPager; private SlidingTabLayout tabs; private TabsPagerAdapter adapter; protected ArrayList fragments = new ArrayList<>(); - protected String handlerIdentifier = UUID.randomUUID().toString(); - static DateFormat formatter = new SimpleDateFormat("HH:mm:ss:SSS"); @Override protected void onCreate(Bundle savedInstanceState) { @@ -55,7 +33,7 @@ public class RemoteMainActivity extends ActionBarActivity implements ActivityInt tabs = (SlidingTabLayout) findViewById(R.id.tabs); tabs.setDistributeEvenly(true); tabs.setViewPager(viewPager); - EthereumApplication.ethereum.registerHandler(this); + } @Override @@ -89,95 +67,4 @@ public class RemoteMainActivity extends ActionBarActivity implements ActivityInt } } - @Override - public boolean handleMessage(Message message) { - - boolean isClaimed = true; - switch(message.what) { - case EthereumClientMessage.MSG_EVENT: - Bundle data = message.getData(); - data.setClassLoader(EventFlag.class.getClassLoader()); - EventFlag event = (EventFlag)data.getSerializable("event"); - EventData eventData; - MessageEventData messageEventData; - switch(event) { - case EVENT_BLOCK: - BlockEventData blockEventData = data.getParcelable("data"); - addLogEntry(blockEventData.registeredTime, "Added block with " + blockEventData.receipts.size() + " transaction receipts."); - break; - case EVENT_HANDSHAKE_PEER: - messageEventData = data.getParcelable("data"); - addLogEntry(messageEventData.registeredTime, "Peer " + new HelloMessage(messageEventData.message).getPeerId() + " said hello"); - break; - case EVENT_NO_CONNECTIONS: - eventData = data.getParcelable("data"); - addLogEntry(eventData.registeredTime, "No connections"); - break; - case EVENT_PEER_DISCONNECT: - PeerDisconnectEventData peerDisconnectEventData = data.getParcelable("data"); - addLogEntry(peerDisconnectEventData.registeredTime, "Peer " + peerDisconnectEventData.host + ":" + peerDisconnectEventData.port + " disconnected."); - break; - case EVENT_PENDING_TRANSACTIONS_RECEIVED: - PendingTransactionsEventData pendingTransactionsEventData = data.getParcelable("data"); - addLogEntry(pendingTransactionsEventData.registeredTime, "Received " + pendingTransactionsEventData.transactions.size() + " pending transactions"); - break; - case EVENT_RECEIVE_MESSAGE: - messageEventData = data.getParcelable("data"); - addLogEntry(messageEventData.registeredTime, "Received message: " + messageEventData.messageClass.getName()); - break; - case EVENT_SEND_MESSAGE: - messageEventData = data.getParcelable("data"); - addLogEntry(messageEventData.registeredTime, "Sent message: " + messageEventData.messageClass.getName()); - break; - case EVENT_SYNC_DONE: - eventData = data.getParcelable("data"); - addLogEntry(eventData.registeredTime, "Sync done"); - break; - case EVENT_VM_TRACE_CREATED: - VMTraceCreatedEventData vmTraceCreatedEventData = data.getParcelable("data"); - addLogEntry(vmTraceCreatedEventData.registeredTime, "CM trace created: " + vmTraceCreatedEventData.transactionHash + " - " + vmTraceCreatedEventData.trace); - break; - case EVENT_TRACE: - TraceEventData traceEventData = data.getParcelable("data"); - addLogEntry(traceEventData.registeredTime, traceEventData.message); - break; - } - break; - default: - isClaimed = false; - } - return isClaimed; - } - - protected void addLogEntry(long timestamp, String message) { - - Date date = new Date(timestamp); - - EthereumApplication.log += formatter.format(date) + " -> " + message + "\n\n"; - if (EthereumApplication.log.length() > 10000) { - EthereumApplication.log = EthereumApplication.log.substring(5000); - } - for(FragmentInterface fragment: fragments) { - fragment.onMessage(EthereumApplication.log); - } - } - - @Override - public String getID() { - - return handlerIdentifier; - } - - @Override - public void onConnectorConnected() { - - EthereumApplication.ethereum.addListener(handlerIdentifier, EnumSet.allOf(EventFlag.class)); - //app.ethereum.connect(SystemProperties.CONFIG.activePeerIP(), SystemProperties.CONFIG.activePeerPort(), SystemProperties.CONFIG.activePeerNodeid()); - //app.ethereum.startJsonRpc(); - } - - @Override - public void onConnectorDisconnected() { - - } } diff --git a/app/src/main/java/org/ethereum/android_app/TestsFragment.java b/app/src/main/java/org/ethereum/android_app/TestsFragment.java index e53ecde2..32b3c4fe 100644 --- a/app/src/main/java/org/ethereum/android_app/TestsFragment.java +++ b/app/src/main/java/org/ethereum/android_app/TestsFragment.java @@ -56,8 +56,7 @@ public class TestsFragment extends Fragment implements ConnectorHandler { getEthereumStatus.setOnClickListener(onClickListener); getBlockchainStatus.setOnClickListener(onClickListener); - EthereumApplication app = (EthereumApplication)getActivity().getApplication(); - app.ethereum.registerHandler(this); + EthereumApplication.ethereum.registerHandler(this); return view; } @@ -66,17 +65,16 @@ public class TestsFragment extends Fragment implements ConnectorHandler { @Override public void onClick(final View v) { - EthereumApplication app = (EthereumApplication)getActivity().getApplication(); switch(v.getId()){ case R.id.connectButton: - //app.ethereum.connect(CONFIG.activePeerIP(), CONFIG.activePeerPort(), CONFIG.activePeerNodeid()); + EthereumApplication.ethereum.connect("192.168.122.90", 30303, "aceb348f4fd7b9b5033b1703b724970d93dbc6ee8410bdc20bc0585e668d629e542cd8ec560311fc8f4a0851c914aae8945555adee73878063dfa0078cc03e07"); break; case R.id.getEthereumStatus: - app.ethereum.getConnectionStatus(identifier); - app.ethereum.getAdminInfo(identifier); + EthereumApplication.ethereum.getConnectionStatus(identifier); + EthereumApplication.ethereum.getAdminInfo(identifier); break; case R.id.getBlockchainStatus: - app.ethereum.getBlockchainStatus(identifier); + EthereumApplication.ethereum.getBlockchainStatus(identifier); break; } } @@ -134,9 +132,8 @@ public class TestsFragment extends Fragment implements ConnectorHandler { @Override public void onConnectorConnected() { - EthereumApplication app = (EthereumApplication)getActivity().getApplication(); - app.ethereum.addListener(identifier, EnumSet.allOf(EventFlag.class)); - //app.ethereum.connect(SystemProperties.CONFIG.activePeerIP(), SystemProperties.CONFIG.activePeerPort(), SystemProperties.CONFIG.activePeerNodeid()); + EthereumApplication.ethereum.addListener(identifier, EnumSet.allOf(EventFlag.class)); + //EthereumApplication.ethereum.connect(SystemProperties.CONFIG.activePeerIP(), SystemProperties.CONFIG.activePeerPort(), SystemProperties.CONFIG.activePeerNodeid()); } @Override diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/Ethereum.java b/ethereumj-core-android/src/main/java/org/ethereum/android/Ethereum.java index 1d3bd738..95b3ca6f 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/Ethereum.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/Ethereum.java @@ -64,6 +64,7 @@ public class Ethereum implements org.ethereum.facade.Ethereum { this.listener = listener; this.peerServer = peerServer; this.worldManager.setEthereum(this); + getDefaultPeer(); } @Override diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/di/components/EthereumComponent.java b/ethereumj-core-android/src/main/java/org/ethereum/android/di/components/EthereumComponent.java index aaf0840d..933f8122 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/di/components/EthereumComponent.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/di/components/EthereumComponent.java @@ -3,7 +3,7 @@ package org.ethereum.android.di.components; import android.content.Context; import org.ethereum.android.di.modules.EthereumModule; -import org.ethereum.facade.Ethereum; +import org.ethereum.android.Ethereum; import org.ethereum.net.rlpx.discover.UDPListener; import javax.inject.Singleton; diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/service/EthereumConnector.java b/ethereumj-core-android/src/main/java/org/ethereum/android/service/EthereumConnector.java index 8866b782..ddee6f71 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/service/EthereumConnector.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/service/EthereumConnector.java @@ -3,6 +3,7 @@ package org.ethereum.android.service; import android.content.Context; import android.os.Bundle; import android.os.Message; +import android.os.Messenger; import android.os.RemoteException; import org.ethereum.android.service.events.EventFlag; @@ -13,6 +14,7 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.EnumSet; +import java.util.HashMap; import java.util.List; @@ -20,25 +22,51 @@ public class EthereumConnector extends ServiceConnector { private static final Logger logger = LoggerFactory.getLogger("EthereumConnector"); + protected ArrayList messages = new ArrayList<>(); + public EthereumConnector(Context context, Class serviceClass) { super(context, serviceClass); } - public void init(List privateKeys) { + @Override + protected void onConnected() { - if (!isBound) - return; + if (messages.size() > 0) { + for(Message message: messages) { + sendMessage(message); + } + messages.clear(); + } + } + + protected void sendMessage(Message message) { + + if (!isBound) { + messages.add(message); + } else { + try { + serviceMessenger.send(message); + } catch (RemoteException e) { + logger.error("Exception sending message(" + message.toString() + ") to service: " + e.getMessage()); + } + } + } + + protected Bundle getIdentifierBundle(String identifier) { + + Bundle bundle = new Bundle(); + bundle.putString("identifier", identifier); + return bundle; + } + + public void init(List privateKeys) { Message msg = Message.obtain(null, EthereumServiceMessage.MSG_INIT, 0, 0); Bundle data = new Bundle(); - data.putStringArrayList("privateKeys", (ArrayList)privateKeys); + data.putStringArrayList("privateKeys", (ArrayList) privateKeys); msg.setData(data); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(init) to service: " + e.getMessage()); - } + sendMessage(msg); } /** @@ -56,20 +84,13 @@ public class EthereumConnector extends ServiceConnector { */ public void connect(String ip, int port, String remoteId) { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_CONNECT, 0, 0); Bundle data = new Bundle(); data.putString("ip", ip); data.putInt("port", port); data.putString("remoteId", remoteId); msg.setData(data); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(connect) to service: " + e.getMessage()); - } + sendMessage(msg); } /** @@ -83,18 +104,11 @@ public class EthereumConnector extends ServiceConnector { */ public void loadBlocks(String dumpFile) { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_LOAD_BLOCKS, 0, 0); Bundle data = new Bundle(); data.putString("dumpFile", dumpFile); msg.setData(data); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(loadBlocks) to service: " + e.getMessage()); - } + sendMessage(msg); } /** @@ -104,15 +118,8 @@ public class EthereumConnector extends ServiceConnector { */ public void startJsonRpc() { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_START_JSON_RPC_SERVER, 0, 0); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(startJsonRpc) to service: " + e.getMessage()); - } + sendMessage(msg); } /** @@ -123,17 +130,10 @@ public class EthereumConnector extends ServiceConnector { */ public void findOnlinePeer(String identifier) { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_FIND_ONLINE_PEER, 0, 0); msg.replyTo = clientMessenger; msg.obj = getIdentifierBundle(identifier); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(findOnlinePeer1) to service: " + e.getMessage()); - } + sendMessage(msg); } /** @@ -148,20 +148,13 @@ public class EthereumConnector extends ServiceConnector { */ public void findOnlinePeer(String identifier, PeerInfo excludePeer) { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_FIND_ONLINE_PEER, 0, 0); msg.replyTo = clientMessenger; msg.obj = getIdentifierBundle(identifier); Bundle data = new Bundle(); data.putParcelable("excludePeer", (org.ethereum.android.interop.PeerInfo) excludePeer); msg.setData(data); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(findOnlinePeer2) to service: " + e.getMessage()); - } + sendMessage(msg); } /** @@ -176,20 +169,13 @@ public class EthereumConnector extends ServiceConnector { */ public void findOnlinePeer(String identifier, PeerInfo[] excludePeerSet) { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_FIND_ONLINE_PEER, 0, 0); msg.replyTo = clientMessenger; msg.obj = getIdentifierBundle(identifier); Bundle data = new Bundle(); data.putParcelableArray("excludePeerSet", (org.ethereum.android.interop.PeerInfo[]) excludePeerSet); msg.setData(data); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(findOnlinePeer3) to service: " + e.getMessage()); - } + sendMessage(msg); } /** @@ -200,17 +186,10 @@ public class EthereumConnector extends ServiceConnector { */ public void getPeers(String identifier) { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_GET_PEERS, 0, 0); msg.replyTo = clientMessenger; msg.obj = getIdentifierBundle(identifier); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(getPeers) to service: " + e.getMessage()); - } + sendMessage(msg); } /** @@ -220,15 +199,8 @@ public class EthereumConnector extends ServiceConnector { */ public void startPeerDiscovery() { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_START_PEER_DISCOVERY, 0, 0); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(startPeerDiscovery) to service: " + e.getMessage()); - } + sendMessage(msg); } /** @@ -238,25 +210,10 @@ public class EthereumConnector extends ServiceConnector { */ public void stopPeerDiscovery() { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_LOAD_BLOCKS, 0, 0); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(stopPeerDiscovery) to service: " + e.getMessage()); - } + sendMessage(msg); } - protected Bundle getIdentifierBundle(String identifier) { - - Bundle bundle = new Bundle(); - bundle.putString("identifier", identifier); - return bundle; - } - - /** * Gets the blockchain status * @param identifier String Caller identifier used to return the response @@ -265,17 +222,10 @@ public class EthereumConnector extends ServiceConnector { */ public void getBlockchainStatus(String identifier) { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_GET_BLOCKCHAIN_STATUS, 0, 0); msg.replyTo = clientMessenger; msg.obj = getIdentifierBundle(identifier); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(getBlockchainStatus) to service: " + e.getMessage()); - } + sendMessage(msg); } /** @@ -289,20 +239,13 @@ public class EthereumConnector extends ServiceConnector { */ public void addListener(String identifier, EnumSet flags) { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_ADD_LISTENER, 0, 0); msg.replyTo = clientMessenger; msg.obj = getIdentifierBundle(identifier); Bundle data = new Bundle(); data.putSerializable("flags", flags); msg.setData(data); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(addListener) to service: " + e.getMessage()); - } + sendMessage(msg); } /** @@ -313,17 +256,10 @@ public class EthereumConnector extends ServiceConnector { */ public void removeListener(String identifier) { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_REMOVE_LISTENER, 0, 0); msg.replyTo = clientMessenger; msg.obj = getIdentifierBundle(identifier); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(addListener) to service: " + e.getMessage()); - } + sendMessage(msg); } @@ -334,15 +270,8 @@ public class EthereumConnector extends ServiceConnector { */ public void closeEthereum() { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_CLOSE, 0, 0); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(closeEthereum) to service: " + e.getMessage()); - } + sendMessage(msg); } /** @@ -353,17 +282,10 @@ public class EthereumConnector extends ServiceConnector { */ public void getConnectionStatus(String identifier) { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_GET_CONNECTION_STATUS, 0, 0); msg.replyTo = clientMessenger; msg.obj = getIdentifierBundle(identifier); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(getConnectionStatus) to service: " + e.getMessage()); - } + sendMessage(msg); } /** @@ -378,20 +300,13 @@ public class EthereumConnector extends ServiceConnector { */ public void submitTransaction(String identifier, Transaction transaction) { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_SUBMIT_TRANSACTION, 0, 0); msg.replyTo = clientMessenger; msg.obj = getIdentifierBundle(identifier); Bundle data = new Bundle(); data.putParcelable("transaction", (org.ethereum.android.interop.Transaction)transaction); msg.setData(data); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(submitTransaction) to service: " + e.getMessage()); - } + sendMessage(msg); } /** @@ -402,17 +317,10 @@ public class EthereumConnector extends ServiceConnector { */ public void getAdminInfo(String identifier) { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_GET_ADMIN_INFO, 0, 0); msg.replyTo = clientMessenger; msg.obj = getIdentifierBundle(identifier); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(getAdminInfo) to service: " + e.getMessage()); - } + sendMessage(msg); } /** @@ -423,17 +331,10 @@ public class EthereumConnector extends ServiceConnector { */ public void getPendingTransactions(String identifier) { - if (!isBound) - return; - Message msg = Message.obtain(null, EthereumServiceMessage.MSG_GET_PENDING_TRANSACTIONS, 0, 0); msg.replyTo = clientMessenger; msg.obj = getIdentifierBundle(identifier); - try { - serviceMessenger.send(msg); - } catch (RemoteException e) { - logger.error("Exception sending message(getPendingTransactions) to service: " + e.getMessage()); - } + sendMessage(msg); } } diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/service/EthereumRemoteService.java b/ethereumj-core-android/src/main/java/org/ethereum/android/service/EthereumRemoteService.java index d26b1538..18b65b5f 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/service/EthereumRemoteService.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/service/EthereumRemoteService.java @@ -112,9 +112,7 @@ public class EthereumRemoteService extends EthereumService { for (String identifier: listeners) { Messenger listener = clientListeners.get(identifier); if (listener != null) { - if (message == null) { - message = createEventMessage(event, data); - } + message = createEventMessage(event, data); message.obj = getIdentifierBundle(identifier); try { listener.send(message); @@ -228,7 +226,19 @@ public class EthereumRemoteService extends EthereumService { } @Override - protected Ethereum initializeEthereum() { + protected void onEthereumCreated(List privateKeys) { + + if (ethereum != null) { + ethereum.init(privateKeys); + startJsonRpc(null); + broadcastEvent(EventFlag.EVENT_SYNC_DONE, new EventData()); + isEthereumStarted = true; + isInitialized = true; + } + } + + @Override + protected void createEthereum() { System.setProperty("sun.arch.data.model", "32"); System.setProperty("leveldb.mmap", "false"); @@ -248,16 +258,9 @@ public class EthereumRemoteService extends EthereumService { component = DaggerEthereumComponent.builder() .ethereumModule(new EthereumModule(this)) .build(); + component.udpListener(); ethereum = component.ethereum(); ethereum.addListener(new EthereumListener()); - ethereum.init(); - //ethereum.getDefaultPeer(); - //component.udpListener(); - startJsonRpc(null); - - broadcastEvent(EventFlag.EVENT_SYNC_DONE, new EventData()); - - return null; } protected void init(Message message) { @@ -267,12 +270,10 @@ public class EthereumRemoteService extends EthereumService { ethereum = null; component = null; isInitialized = false; - initializeEthereum(); } Bundle data = message.getData(); List privateKeys = data.getStringArrayList("privateKeys"); - ethereum.init(); - isEthereumStarted = true; + new InitializeTask(privateKeys).execute(); } /** @@ -289,7 +290,7 @@ public class EthereumRemoteService extends EthereumService { protected void connect(Message message) { if (!isConnected) { - isConnected = true; + //isConnected = true; new ConnectTask(message).execute(ethereum); } } @@ -311,7 +312,11 @@ public class EthereumRemoteService extends EthereumService { protected Void doInBackground(Ethereum... args) { Ethereum ethereum = args[0]; - ethereum.connect(ip, port, remoteId); + try { + ethereum.connect(ip, port, remoteId); + } catch(Exception e) { + System.out.println(e.getMessage()); + } logger.info("Ethereum connecting to : " + ip + ":" + port); return null; } diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/service/EthereumService.java b/ethereumj-core-android/src/main/java/org/ethereum/android/service/EthereumService.java index e3eb3aa1..d4b136eb 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/service/EthereumService.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/service/EthereumService.java @@ -3,10 +3,9 @@ package org.ethereum.android.service; import android.app.Service; import android.content.Intent; import android.os.AsyncTask; -import android.os.Bundle; import android.os.IBinder; -import android.os.Message; +import org.spongycastle.util.encoders.Hex; import org.ethereum.android.di.components.DaggerEthereumComponent; import org.ethereum.android.di.components.EthereumComponent; import org.ethereum.android.di.modules.EthereumModule; @@ -19,11 +18,11 @@ import org.ethereum.android.service.events.PeerDisconnectEventData; import org.ethereum.android.service.events.PendingTransactionsEventData; import org.ethereum.android.service.events.TraceEventData; import org.ethereum.android.service.events.VMTraceCreatedEventData; -import org.ethereum.config.SystemProperties; import org.ethereum.core.Genesis; import org.ethereum.core.Transaction; import org.ethereum.core.TransactionReceipt; -import org.ethereum.facade.Ethereum; +import org.ethereum.android.Ethereum; +import org.ethereum.crypto.HashUtil; import org.ethereum.net.eth.StatusMessage; import org.ethereum.net.p2p.HelloMessage; import org.ethereum.net.rlpx.Node; @@ -60,7 +59,7 @@ public class EthereumService extends Service { super.onCreate(); if (!isInitialized) { isInitialized = true; - new InitializeTask().execute(ethereum); + new InitializeTask(null).execute(); } else { System.out.println(" Already initialized"); System.out.println("x " + (ethereum != null)); @@ -76,26 +75,44 @@ public class EthereumService extends Service { ethereum.close(); } - protected class InitializeTask extends AsyncTask { + protected class InitializeTask extends AsyncTask { - public InitializeTask() { + protected List privateKeys = null; + public InitializeTask(List privateKeys) { + + this.privateKeys = privateKeys; } - protected Ethereum doInBackground(Ethereum... args) { + protected Void doInBackground(Void... args) { - return initializeEthereum(); + createEthereum(); + return null; } - protected void onPostExecute(Ethereum results) { + protected void onPostExecute(Void results) { - if (results != null) { - EthereumService.ethereum = results; - } + onEthereumCreated(privateKeys); } } - protected Ethereum initializeEthereum() { + protected void onEthereumCreated(List privateKeys) { + + if (ethereum != null) { + if (privateKeys == null || privateKeys.size() == 0) { + byte[] cowAddr = HashUtil.sha3("cow".getBytes()); + privateKeys.add(Hex.toHexString(cowAddr)); + + String secret = CONFIG.coinbaseSecret(); + byte[] cbAddr = HashUtil.sha3(secret.getBytes()); + privateKeys.add(Hex.toHexString(cbAddr)); + } + ethereum.init(privateKeys); + broadcastEvent(EventFlag.EVENT_SYNC_DONE, new EventData()); + } + } + + protected void createEthereum() { Ethereum ethereum = null; @@ -119,9 +136,6 @@ public class EthereumService extends Service { .build(); ethereum = component.ethereum(); ethereum.addListener(new EthereumListener()); - ethereum.init(); - - return ethereum; } @Override diff --git a/ethereumj-core-android/src/main/java/org/ethereum/android/service/ServiceConnector.java b/ethereumj-core-android/src/main/java/org/ethereum/android/service/ServiceConnector.java index 5abcaedb..04532453 100644 --- a/ethereumj-core-android/src/main/java/org/ethereum/android/service/ServiceConnector.java +++ b/ethereumj-core-android/src/main/java/org/ethereum/android/service/ServiceConnector.java @@ -56,12 +56,16 @@ public class ServiceConnector { public void handleMessage(Message message) { boolean isClaimed = false; + System.out.println("AAAAAAAAAAAAAAAAAAAAAAAAA"); String identifier = ((Bundle)message.obj).getString("identifier"); if (identifier != null) { for (ConnectorHandler handler : handlers) { if (identifier.equals(handler.getID())) { isClaimed = handler.handleMessage(message); + if (isClaimed) { + break; + } } } } @@ -88,6 +92,7 @@ public class ServiceConnector { for (ConnectorHandler handler: handlers) { handler.onConnectorConnected(); } + onConnected(); } public void onServiceDisconnected(ComponentName className) { @@ -102,6 +107,10 @@ public class ServiceConnector { } }; + protected void onConnected() { + + } + public ServiceConnector(Context context, Class serviceClass) { this.context = context; diff --git a/ethereumj-core/src/main/java/org/ethereum/core/BlockchainImpl.java b/ethereumj-core/src/main/java/org/ethereum/core/BlockchainImpl.java index 8d3c819e..81aa7312 100644 --- a/ethereumj-core/src/main/java/org/ethereum/core/BlockchainImpl.java +++ b/ethereumj-core/src/main/java/org/ethereum/core/BlockchainImpl.java @@ -32,11 +32,13 @@ import javax.inject.Inject; import javax.inject.Singleton; import static java.lang.Runtime.getRuntime; +import static java.math.BigInteger.ZERO; import static org.ethereum.config.Constants.*; import static org.ethereum.config.SystemProperties.CONFIG; import static org.ethereum.core.Denomination.SZABO; import static org.ethereum.core.ImportResult.*; import static org.ethereum.util.BIUtil.isMoreThan; +import static org.ethereum.util.BIUtil.toBI; /** * The Ethereum blockchain is in many ways similar to the Bitcoin blockchain, @@ -86,7 +88,7 @@ public class BlockchainImpl implements Blockchain, org.ethereum.facade.Blockchai private BlockStore blockStore; private Block bestBlock; - private BigInteger totalDifficulty = BigInteger.ZERO; + private BigInteger totalDifficulty = ZERO; Wallet wallet; @@ -250,14 +252,14 @@ public class BlockchainImpl implements Blockchain, org.ethereum.facade.Blockchai // The simple case got the block // to connect to the main chain if (bestBlock.isParentOf(block)) { - add(block); recordBlock(block); + add(block); return IMPORTED_BEST; } else { if (blockStore.isBlockExist(block.getParentHash())) { + recordBlock(block); ImportResult result = tryConnectAndFork(block); - if (result == IMPORTED_BEST || result == IMPORTED_NOT_BEST) recordBlock(block); return result; } @@ -650,7 +652,7 @@ public class BlockchainImpl implements Blockchain, org.ethereum.facade.Blockchai adminInfo.lostConsensus(); System.out.println("CONFLICT: BLOCK #" + block.getNumber() ); -// System.exit(1); + System.exit(1); // in case of rollback hard move the root // Block parentBlock = blockStore.getBlockByHash(block.getParentHash()); // repository.syncToRoot(parentBlock.getStateRoot()); @@ -722,17 +724,9 @@ public class BlockchainImpl implements Blockchain, org.ethereum.facade.Blockchai if (!CONFIG.recordBlocks()) return; - if (block.getNumber() == 1) { - try { - FileUtils.forceDelete(new File(CONFIG.dumpDir())); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } + String dumpDir = CONFIG.databaseDir() + "/" + CONFIG.dumpDir(); - String dir = CONFIG.dumpDir() + "/"; - - File dumpFile = new File(System.getProperty("user.dir") + "/" + dir + "_blocks_rec.txt"); + File dumpFile = new File(dumpDir + "/blocks-rec.dmp"); FileWriter fw = null; BufferedWriter bw = null; @@ -776,7 +770,18 @@ public class BlockchainImpl implements Blockchain, org.ethereum.facade.Blockchai long number = bestBlock.getNumber(); for (Transaction tx : transactions) { - pendingTransactions.add(new PendingTransaction(tx, number)); + + BigInteger txNonce = toBI(tx.getNonce()); + if (repository.isExist(tx.getSender())){ + + BigInteger currNonce = repository.getAccountState(tx.getSender()).getNonce(); + if (currNonce.equals(txNonce)) + pendingTransactions.add(new PendingTransaction(tx, number)); + } else { + + if (txNonce.equals(ZERO)) + pendingTransactions.add(new PendingTransaction(tx, number)); + } } } diff --git a/ethereumj-core/src/main/java/org/ethereum/datasource/mapdb/MapDBFactoryImpl.java b/ethereumj-core/src/main/java/org/ethereum/datasource/mapdb/MapDBFactoryImpl.java index f33004a1..e184c38d 100644 --- a/ethereumj-core/src/main/java/org/ethereum/datasource/mapdb/MapDBFactoryImpl.java +++ b/ethereumj-core/src/main/java/org/ethereum/datasource/mapdb/MapDBFactoryImpl.java @@ -10,8 +10,11 @@ import java.io.File; import java.util.HashMap; import java.util.Map; +import javax.inject.Singleton; + import static java.lang.System.getProperty; +@Singleton public class MapDBFactoryImpl implements MapDBFactory { @Override diff --git a/ethereumj-core/src/main/java/org/ethereum/manager/WorldManager.java b/ethereumj-core/src/main/java/org/ethereum/manager/WorldManager.java index e480c7b8..145b2ab2 100644 --- a/ethereumj-core/src/main/java/org/ethereum/manager/WorldManager.java +++ b/ethereumj-core/src/main/java/org/ethereum/manager/WorldManager.java @@ -96,6 +96,7 @@ public class WorldManager { } public void setEthereum(Ethereum ethereum) { + this.syncManager.setEthereum(ethereum); } diff --git a/ethereumj-core/src/main/java/org/ethereum/net/eth/BlockHashesMessage.java b/ethereumj-core/src/main/java/org/ethereum/net/eth/BlockHashesMessage.java index cb879a65..388f8587 100644 --- a/ethereumj-core/src/main/java/org/ethereum/net/eth/BlockHashesMessage.java +++ b/ethereumj-core/src/main/java/org/ethereum/net/eth/BlockHashesMessage.java @@ -35,7 +35,7 @@ public class BlockHashesMessage extends EthMessage { RLPList paramsList = (RLPList) RLP.decode2(encoded).get(0); blockHashes = new ArrayList<>(); - for (int i = 1; i < paramsList.size(); ++i) { + for (int i = 0; i < paramsList.size(); ++i) { RLPItem rlpData = ((RLPItem) paramsList.get(i)); blockHashes.add(rlpData.getRLPData()); } diff --git a/ethereumj-core/src/main/java/org/ethereum/net/eth/SyncManager.java b/ethereumj-core/src/main/java/org/ethereum/net/eth/SyncManager.java index f0d3dca6..6607b971 100644 --- a/ethereumj-core/src/main/java/org/ethereum/net/eth/SyncManager.java +++ b/ethereumj-core/src/main/java/org/ethereum/net/eth/SyncManager.java @@ -157,6 +157,10 @@ public class SyncManager { } } ); + + for (Node node : CONFIG.peerActive()) { + initiateConnection(node); + } } public void setBlockChain(Blockchain blockchain) { diff --git a/ethereumj-core/src/main/java/org/ethereum/net/rlpx/discover/PeerConnectionTester.java b/ethereumj-core/src/main/java/org/ethereum/net/rlpx/discover/PeerConnectionTester.java index 242acb44..05968324 100644 --- a/ethereumj-core/src/main/java/org/ethereum/net/rlpx/discover/PeerConnectionTester.java +++ b/ethereumj-core/src/main/java/org/ethereum/net/rlpx/discover/PeerConnectionTester.java @@ -3,6 +3,7 @@ package org.ethereum.net.rlpx.discover; import org.apache.commons.codec.binary.Hex; import org.ethereum.config.SystemProperties; import org.ethereum.manager.WorldManager; +import org.ethereum.net.client.PeerClient; import org.ethereum.net.rlpx.Node; import org.slf4j.LoggerFactory; @@ -60,8 +61,11 @@ public class PeerConnectionTester { nodeHandler.getNodeStatistics().rlpxConnectionAttempts.add(); logger.debug("Trying node connection: " + nodeHandler); Node node = nodeHandler.getNode(); - worldManager.getActivePeer().connect(node.getHost(), node.getPort(), + PeerClient activePeer = worldManager.getActivePeer(); + if (activePeer != null) { + activePeer.connect(node.getHost(), node.getPort(), new String(Hex.encodeHex(node.getId())), true); + } logger.debug("Terminated node connection: " + nodeHandler); nodeHandler.getNodeStatistics().disconnected(); if (!nodeHandler.getNodeStatistics().getEthTotalDifficulty().equals(BigInteger.ZERO) && diff --git a/ethereumj-core/src/main/resources/ethereumj.conf b/ethereumj-core/src/main/resources/ethereumj.conf index 2524415b..792b9669 100644 --- a/ethereumj-core/src/main/resources/ethereumj.conf +++ b/ethereumj-core/src/main/resources/ethereumj.conf @@ -19,6 +19,7 @@ peer.discovery = { ip.list = [ "54.94.239.50:30303", "52.16.188.185:30303", + "139.162.13.89:30303" ] # indicates if the discovered nodes and their reputations @@ -39,6 +40,11 @@ peer { # Boot node list active = [ + { + ip: "192.168.122.90", + port: 30303, + nodeId: "aceb348f4fd7b9b5033b1703b724970d93dbc6ee8410bdc20bc0585e668d629e542cd8ec560311fc8f4a0851c914aae8945555adee73878063dfa0078cc03e07" + } ] # The protocols supported by peer diff --git a/ethereumj-core/src/main/resources/log4j-detailed.properties b/ethereumj-core/src/main/resources/log4j-detailed.properties index 447da3c4..e41d5286 100644 --- a/ethereumj-core/src/main/resources/log4j-detailed.properties +++ b/ethereumj-core/src/main/resources/log4j-detailed.properties @@ -6,7 +6,7 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern= %d{HH:mm:ss} [%c{1}] %m%n -log4j.appender.stdout.Threshold=ERROR +log4j.appender.stdout.Threshold=INFO log4j.appender.file=org.apache.log4j.rolling.RollingFileAppender log4j.appender.file.layout=org.apache.log4j.PatternLayout @@ -15,22 +15,22 @@ log4j.appender.file.RollingPolicy=org.apache.log4j.rolling.TimeBasedRollingPolic log4j.appender.file.RollingPolicy.FileNamePattern=./logs/ethereum_%d{yyyy-MM-dd}_h%d{HH}.log # filter noisy classes -log4j.logger.org.ethereum.core = ERROR -log4j.logger.org.ethereum.net = ERROR -log4j.logger.org.ethereum.db = ERROR -log4j.logger.peerdiscovery = ERROR -log4j.logger.java.nio = ERROR -log4j.logger.io.netty = ERROR -log4j.logger.wire = ERROR -log4j.logger.wallet = ERROR -log4j.logger.VM = TRACE +log4j.logger.org.ethereum.core = INFO +log4j.logger.org.ethereum.net = INFO +log4j.logger.org.ethereum.db = INFO +log4j.logger.peerdiscovery = INFO +log4j.logger.java.nio = INFO +log4j.logger.io.netty = INFO +log4j.logger.wire = INFO +log4j.logger.wallet = INFO +log4j.logger.VM = INFO log4j.logger.dump = OFF log4j.logger.main = INFO -log4j.logger.trie = ERROR -log4j.logger.state = DEBUG +log4j.logger.trie = INFO +log4j.logger.state = INFO log4j.logger.repository = INFO log4j.logger.blockchain = INFO -log4j.logger.ui = ERROR -log4j.logger.txs = ERROR -log4j.logger.gas = ERROR +log4j.logger.ui = INFO +log4j.logger.txs = INFO +log4j.logger.gas = INFO diff --git a/ethereumj-core/src/main/resources/log4j.properties b/ethereumj-core/src/main/resources/log4j.properties index b842b240..0306e481 100644 --- a/ethereumj-core/src/main/resources/log4j.properties +++ b/ethereumj-core/src/main/resources/log4j.properties @@ -16,35 +16,35 @@ log4j.appender.file.RollingPolicy.FileNamePattern=./logs/ethereum_%d{yyyy-MM-dd} log4j.appender.file.Threshold=TRACE # filter noisy classes -log4j.logger.block = ERROR +log4j.logger.block = INFO log4j.logger.blockqueue = INFO -log4j.logger.wallet = ERROR +log4j.logger.wallet = INFO log4j.logger.general = INFO -log4j.logger.net = ERROR -log4j.logger.db = ERROR -log4j.logger.peerdiscovery = ERROR +log4j.logger.net = INFO +log4j.logger.db = INFO +log4j.logger.peerdiscovery = INFO log4j.logger.discover = INFO -log4j.logger.peermonitor = ERROR -log4j.logger.java.nio = ERROR -log4j.logger.io.netty = ERROR -log4j.logger.wire = ERROR -log4j.logger.VM = ERROR -log4j.logger.main = ERROR -log4j.logger.trie = ERROR -log4j.logger.state = ERROR -log4j.logger.repository = ERROR -log4j.logger.blockchain = ERROR -log4j.logger.txs = ERROR -log4j.logger.ui = ERROR -log4j.logger.gas = ERROR -log4j.logger.cli = ERROR -log4j.logger.TCK-Test = ERROR -log4j.logger.execute = ERROR -log4j.logger.rlp = ERROR +log4j.logger.peermonitor = INFO +log4j.logger.java.nio = INFO +log4j.logger.io.netty = INFO +log4j.logger.wire = INFO +log4j.logger.VM = INFO +log4j.logger.main = INFO +log4j.logger.trie = INFO +log4j.logger.state = INFO +log4j.logger.repository = INFO +log4j.logger.blockchain = INFO +log4j.logger.txs = INFO +log4j.logger.ui = INFO +log4j.logger.gas = INFO +log4j.logger.cli = INFO +log4j.logger.TCK-Test = INFO +log4j.logger.execute = INFO +log4j.logger.rlp = INFO log4j.logger.sync = INFO -log4j.logger.org.springframework = ERROR -log4j.logger.org.hibernate = ERROR -log4j.logger.hsqldb.db = ERROR +log4j.logger.org.springframework = INFO +log4j.logger.org.hibernate = INFO +log4j.logger.hsqldb.db = INFO