Search in sources :

Example 1 with NetworkMessageException

use of io.nuls.network.exception.NetworkMessageException in project nuls by nuls-io.

the class VersionEventHandler method process.

@Override
public NetworkEventResult process(BaseEvent networkEvent, Node node) {
    VersionEvent event = (VersionEvent) networkEvent;
    if (event.getBestBlockHeight() < 0) {
        throw new NetworkMessageException(ErrorCode.NET_MESSAGE_ERROR);
    }
    node.setVersionMessage(event);
    checkVersion(event.getNulsVersion());
    if (!node.isHandShake()) {
        node.setStatus(Node.HANDSHAKE);
        node.setPort(event.getExternalPort());
        node.setLastTime(TimeService.currentTimeMillis());
        getNodeDao().saveChange(NodeTransferTool.toPojo(node));
    }
    return null;
}
Also used : VersionEvent(io.nuls.network.message.entity.VersionEvent) NetworkMessageException(io.nuls.network.exception.NetworkMessageException)

Aggregations

NetworkMessageException (io.nuls.network.exception.NetworkMessageException)1 VersionEvent (io.nuls.network.message.entity.VersionEvent)1