Search in sources :

Example 1 with Metrics

use of co.rsk.net.Metrics in project rskj by rsksmart.

the class ChannelManagerImpl method broadcastTransactionMessage.

/**
 * Propagates the transactions message across active peers with exclusion of
 * 'receivedFrom' peer.
 *
 * @param tx           transactions to be sent
 * @param receivedFrom the peer which sent original message or null if
 *                     the transactions were originated by this peer
 */
public void broadcastTransactionMessage(List<Transaction> tx, Channel receivedFrom) {
    tx.forEach(Metrics::broadcastTransaction);
    synchronized (activePeers) {
        TransactionsMessage txsmsg = new TransactionsMessage(tx);
        EthMessage msg = new RskMessage(config, txsmsg);
        for (Channel channel : activePeers.values()) {
            if (channel != receivedFrom) {
                channel.sendMessage(msg);
            }
        }
    }
}
Also used : Metrics(co.rsk.net.Metrics) EthMessage(org.ethereum.net.eth.message.EthMessage) RskMessage(co.rsk.net.eth.RskMessage)

Aggregations

Metrics (co.rsk.net.Metrics)1 RskMessage (co.rsk.net.eth.RskMessage)1 EthMessage (org.ethereum.net.eth.message.EthMessage)1