Exemplo n.º 1
0
void publish_complaint(struct state *state,
		       struct block *block,
		       const void *complaint,
		       struct peer *origin)
{
	/* Don't complaint storm. */
	if (block->complaint) {
		tal_free(complaint);
		return;
	}

	/* FIXME: Save complaint to blockfile! */

	/* If it's invalid, so are any descendents. */
	complaint_on_all(state, block, complaint);

	/* We have dumped all the txs from those blocks into pending. */
	recheck_pending_txs(state);

	/* Recalc everything.  Slow, but should be rare. */
	update_block_ptrs_invalidated(state, block);

	/* Tell everyone (except origin!) */
	broadcast_to_peers(state, complaint, origin);
}
Exemplo n.º 2
0
Arquivo: hub.c Projeto: nizox/hub
static void
interface_callback(evutil_socket_t fd, short ev, void *arg)
{
  struct hub *hub = arg;
  ssize_t n;

  if (ev & EV_READ)
  {
    if ((n = tnt_tun_read(&hub->tun, mbuf, sizeof(mbuf))) > 0)
    {
      hub->tx += n;
      printf("broadcasting %hi bytes (total %hi bytes)\n", n, hub->tx);
      broadcast_to_peers(hub, mbuf, n);
    }
  }
}