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

Function accepter_start

openingd/dualopend.c:2368–2762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2366}
2367
2368static void accepter_start(struct state *state, const u8 *oc2_msg)
2369{
2370 struct bitcoin_blkid chain_hash;
2371 struct tlv_opening_tlvs *open_tlv;
2372 struct channel_id cid, full_cid;
2373 char *err_reason;
2374 u8 *msg;
2375 struct amount_sat total, our_accept;
2376 enum dualopend_wire msg_type;
2377 struct tx_state *tx_state = state->tx_state;
2378
2379 state->our_role = TX_ACCEPTER;
2380
2381 if (!fromwire_open_channel2(tmpctx, oc2_msg, &chain_hash,
2382 &cid,
2383 &tx_state->feerate_per_kw_funding,
2384 &state->feerate_per_kw_commitment,
2385 &tx_state->opener_funding,
2386 &tx_state->remoteconf.dust_limit,
2387 &tx_state->remoteconf.max_htlc_value_in_flight,
2388 &tx_state->remoteconf.htlc_minimum,
2389 &tx_state->remoteconf.to_self_delay,
2390 &tx_state->remoteconf.max_accepted_htlcs,
2391 &tx_state->tx_locktime,
2392 &state->their_funding_pubkey,
2393 &state->their_points.revocation,
2394 &state->their_points.payment,
2395 &state->their_points.delayed_payment,
2396 &state->their_points.htlc,
2397 &state->first_per_commitment_point[REMOTE],
2398 /* We don't actually do anything with this currently,
2399 * as they send it to us again in `channel_ready` */
2400 &state->second_per_commitment_point[REMOTE],
2401 &state->channel_flags,
2402 &open_tlv))
2403 open_err_fatal(state, "Parsing open_channel2 %s",
2404 tal_hex(tmpctx, oc2_msg));
2405
2406 state->require_confirmed_inputs[REMOTE] =
2407 open_tlv->require_confirmed_inputs != NULL;
2408
2409 if (open_tlv->upfront_shutdown_script)
2410 set_remote_upfront_shutdown(state, open_tlv->upfront_shutdown_script);
2411 else
2412 state->upfront_shutdown_script[REMOTE] = NULL;
2413
2414 /* BOLT #2:
2415 * When sending `open_channel2`, the peer's revocation basepoint is unknown.
2416 * A `temporary_channel_id` must be computed by using a zeroed out basepoint
2417 * for the non-initiator.
2418 */
2419 derive_tmp_channel_id(&state->channel_id, /* Temporary! */
2420 &state->their_points.revocation);
2421 if (!channel_id_eq(&state->channel_id, &cid)) {
2422 peer_failed_err(state->pps, &cid,
2423 "open_channel2 channel_id incorrect."
2424 " Expected %s, received %s",
2425 fmt_channel_id(tmpctx,

Callers 1

handle_peer_inFunction · 0.85

Calls 15

open_err_fatalFunction · 0.85
tal_hexFunction · 0.85
derive_tmp_channel_idFunction · 0.85
channel_type_acceptFunction · 0.85
fmt_featurebitsFunction · 0.85
channel_type_fromFunction · 0.85
anchors_negotiatedFunction · 0.85
fmt_bitcoin_blkidFunction · 0.85
feature_negotiatedFunction · 0.85
amount_sat_greaterFunction · 0.85
derive_channel_id_v2Function · 0.85
fromwire_peektypeFunction · 0.85

Tested by

no test coverage detected