Search in sources :

Example 1 with TxGroupEvent

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

the class GetTxGroupHandler method onEvent.

@Override
public void onEvent(GetTxGroupRequest event, String fromId) {
    GetTxGroupParam eventBody = event.getEventBody();
    Block block = blockService.getBlock(eventBody.getBlockHash().getDigestHex());
    if (null == block) {
        return;
    }
    TxGroupEvent txGroupEvent = new TxGroupEvent();
    TxGroup txGroup = new TxGroup();
    txGroup.setBlockHash(block.getHeader().getHash());
    List<Transaction> txList = getTxList(block, eventBody.getTxHashList());
    txGroup.setTxList(txList);
    txGroupEvent.setEventBody(txGroup);
    eventBroadcaster.sendToNode(txGroupEvent, fromId);
}
Also used : TxGroup(io.nuls.consensus.entity.TxGroup) Transaction(io.nuls.core.chain.entity.Transaction) GetTxGroupParam(io.nuls.consensus.entity.GetTxGroupParam) Block(io.nuls.core.chain.entity.Block) TxGroupEvent(io.nuls.consensus.event.TxGroupEvent)

Aggregations

GetTxGroupParam (io.nuls.consensus.entity.GetTxGroupParam)1 TxGroup (io.nuls.consensus.entity.TxGroup)1 TxGroupEvent (io.nuls.consensus.event.TxGroupEvent)1 Block (io.nuls.core.chain.entity.Block)1 Transaction (io.nuls.core.chain.entity.Transaction)1