use of org.tron.protos.Protocol.Inventory.InventoryType in project java-tron by tronprotocol.
the class NodeImpl method broadcast.
/**
* broadcast msg.
*
* @param msg msg to bradcast
*/
public void broadcast(Message msg) {
InventoryType type;
if (msg instanceof BlockMessage) {
logger.info("Ready to broadcast a block, Its hash is " + msg.getMessageId());
freshBlockId.offer(((BlockMessage) msg).getBlockId());
blockToAdvertise.add(((BlockMessage) msg).getBlockId());
type = InventoryType.BLOCK;
} else if (msg instanceof TransactionMessage) {
trxToAdvertise.add(msg.getMessageId());
type = InventoryType.TRX;
} else {
return;
}
// TODO: here need to cache fresh message to let peer fetch these data not from DB
advObjToSpread.put(msg.getMessageId(), type);
}
Aggregations