MCPcopy Create free account
hub / github.com/ElementsProject/lightning / handle_peer_start_batch

Function handle_peer_start_batch

channeld/channeld.c:2552–2588  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2550}
2551
2552static void handle_peer_start_batch(struct peer *peer, const u8 *msg)
2553{
2554 u16 batch_size;
2555 struct channel_id channel_id;
2556 struct tlv_start_batch_tlvs *tlvs;
2557 if (!fromwire_start_batch(tmpctx, msg, &channel_id, &batch_size, &tlvs))
2558 peer_failed_warn(peer->pps, &peer->channel_id,
2559 "Bad start_batch %s", tal_hex(msg, msg));
2560
2561 if (!tlvs || !tlvs->batch_info
2562 || *tlvs->batch_info != WIRE_COMMITMENT_SIGNED) {
2563 status_unusual("Ignoring Unrecognized start_batch message type"
2564 " %s, expected WIRE_COMMITMENT_SIGNED.",
2565 tlvs && tlvs->batch_info
2566 ? peer_wire_name(*tlvs->batch_info)
2567 : "N/A");
2568 return;
2569 }
2570
2571 /* Bolt #2
2572 * A sending node:
2573 * - MUST set batch_size to a value strictly greater than 1.
2574 */
2575 if (batch_size < 2) {
2576 peer_failed_warn(peer->pps, &peer->channel_id,
2577 "Don't send a start_batch with batch size"
2578 "below 2");
2579 }
2580
2581 handle_peer_commit_sig_batch(peer, peer_read(tmpctx, peer->pps),
2582 peer->channel->funding_pubkey[REMOTE],
2583 NULL, 0, 0,
2584 peer->next_index[LOCAL],
2585 &peer->next_local_per_commit,
2586 false,
2587 batch_size);
2588}
2589
2590
2591/* Pops the penalty base for the given commitnum from our internal list. There

Callers 1

peer_inFunction · 0.85

Calls 4

peer_failed_warnFunction · 0.85
tal_hexFunction · 0.85
peer_readFunction · 0.85

Tested by

no test coverage detected