Package org.ethereum.listener

Examples of org.ethereum.listener.EthereumListener


    @Override
    public PeerInfo findOnlinePeer(Set<PeerInfo> excludePeers)  {
        logger.info("Looking for online peers...");

        final EthereumListener listener = worldManager.getListener();
        listener.trace("Looking for online peer");

        worldManager.startPeerDiscovery();

        final Set<PeerInfo> peers = worldManager.getPeerDiscovery().getPeers();
        synchronized (peers) {
            for (PeerInfo peer : peers) { // it blocks until a peer is available.
        if (peer.isOnline() && !excludePeers.contains(peer)) {
                    logger.info("Found peer: {}", peer.toString());
                    if (listener != null)
                        listener.trace(String.format("Found online peer: [ %s ]", peer.toString()));
                    return peer;
                }
            }
        }
        return null;
View Full Code Here


        this.processBlock(block);
       
        // Remove all wallet transactions as they already approved by the net
        worldManager.getWallet().removeTransactions(block.getTransactionsList());

        EthereumListener listener = worldManager.getListener();
        listener.trace(String.format("Block chain size: [ %d ]", this.getSize()));

        EthereumListener ethereumListener =  worldManager.getListener();
        ethereumListener.onBlock(block);

        if (blockQueue.size() == 0 &&
            !syncDoneCalled &&
            channelManager.isAllSync()){

            logger.info("Sync done");
            syncDoneCalled = true;
            ethereumListener.onSyncDone();
        }
    }
View Full Code Here

    if (messageRoundtrip != null && messageRoundtrip.getRetryTimes() == 0) {
      // TODO: retry logic || messageRoundtrip.hasToRetry()){

      Message msg = messageRoundtrip.getMsg();

            EthereumListener listener = worldManager.getListener();
            listener.onSendMessage(msg);

      ctx.writeAndFlush(msg);

      if (msg.getAnswerMessage() == null)
        messageQueue.remove();
View Full Code Here

    Message msg = MessageFactory.createMessage(encoded);

    if (loggerNet.isInfoEnabled())
            loggerNet.info("From: \t{} \tRecv: \t{}", ctx.channel().remoteAddress(), msg);

        EthereumListener listener = worldManager.getListener();
        listener.onRecvMessage(msg);

    out.add(msg);
        in.markReaderIndex();
    }
View Full Code Here

TOP

Related Classes of org.ethereum.listener.EthereumListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.