| 3479 | } |
| 3480 | |
| 3481 | static void rbf_local_start(struct state *state, u8 *msg) |
| 3482 | { |
| 3483 | struct tx_state *tx_state; |
| 3484 | struct channel_id cid; |
| 3485 | struct amount_sat total; |
| 3486 | char *err_reason; |
| 3487 | struct tlv_tx_init_rbf_tlvs *init_rbf_tlvs; |
| 3488 | struct tlv_tx_ack_rbf_tlvs *ack_rbf_tlvs; |
| 3489 | |
| 3490 | /* tmpctx gets cleaned midway, so we have a context for this fn */ |
| 3491 | char *rbf_ctx = notleak_with_children(tal(state, char)); |
| 3492 | size_t locktime; |
| 3493 | |
| 3494 | /* We need a new tx_state! */ |
| 3495 | tx_state = new_tx_state(rbf_ctx); |
| 3496 | /* Copy over the channel config info -- everything except |
| 3497 | * the reserve will be the same */ |
| 3498 | tx_state->localconf = state->tx_state->localconf; |
| 3499 | tx_state->remoteconf = state->tx_state->remoteconf; |
| 3500 | init_rbf_tlvs = tlv_tx_init_rbf_tlvs_new(tmpctx); |
| 3501 | |
| 3502 | if (!fromwire_dualopend_rbf_init(tx_state, msg, |
| 3503 | &tx_state->opener_funding, |
| 3504 | &tx_state->feerate_per_kw_funding, |
| 3505 | &tx_state->psbt)) |
| 3506 | master_badmsg(WIRE_DUALOPEND_RBF_INIT, msg); |
| 3507 | |
| 3508 | peer_billboard(false, "channel rbf: init received from master"); |
| 3509 | |
| 3510 | if (!check_funding_feerate(tx_state->feerate_per_kw_funding, |
| 3511 | state->tx_state->feerate_per_kw_funding)) { |
| 3512 | open_abort(state, "Proposed funding feerate (%u) invalid", |
| 3513 | tx_state->feerate_per_kw_funding); |
| 3514 | return; |
| 3515 | } |
| 3516 | |
| 3517 | /* Have you sent us everything we need yet ? */ |
| 3518 | if (!state->tx_state->remote_funding_sigs_rcvd) { |
| 3519 | /* we're still waiting for the last sigs, master |
| 3520 | * should know better. Tell them no! */ |
| 3521 | open_abort(state, "%s", |
| 3522 | "Still waiting for remote funding sigs" |
| 3523 | " for last open attempt"); |
| 3524 | return; |
| 3525 | } |
| 3526 | |
| 3527 | wally_psbt_get_locktime(tx_state->psbt, &locktime); |
| 3528 | tx_state->tx_locktime = locktime; |
| 3529 | /* For now, we always just echo/send the funding amount */ |
| 3530 | init_rbf_tlvs->funding_output_contribution |
| 3531 | = tal(init_rbf_tlvs, s64); |
| 3532 | *init_rbf_tlvs->funding_output_contribution |
| 3533 | = (s64)tx_state->opener_funding.satoshis; /* Raw: wire conversion */ |
| 3534 | |
| 3535 | |
| 3536 | /* We repeat whatever we used on initial open for requiring confirmed |
| 3537 | * inputs */ |
| 3538 | if (state->require_confirmed_inputs[LOCAL]) |
no test coverage detected