Search in sources :

Example 1 with BlockEvent

use of io.nuls.consensus.event.BlockEvent in project nuls by nuls-io.

the class GetBlockHandler method onEvent.

@Override
public void onEvent(GetBlockRequest event, String fromId) throws NulsException {
    List<Block> blockList = blockService.getBlockList(event.getStart(), event.getEnd());
    for (Block block : blockList) {
        if (null == block) {
            continue;
        }
        BlockEvent blockEvent = new BlockEvent();
        blockEvent.setEventBody(block);
        eventBroadcaster.sendToNode(blockEvent, fromId);
    }
}
Also used : Block(io.nuls.core.chain.entity.Block) BlockEvent(io.nuls.consensus.event.BlockEvent)

Aggregations

BlockEvent (io.nuls.consensus.event.BlockEvent)1 Block (io.nuls.core.chain.entity.Block)1