| 2524 | } |
| 2525 | |
| 2526 | static u8 *got_revoke_msg(struct peer *peer, u64 revoke_num, |
| 2527 | const struct secret *per_commitment_secret, |
| 2528 | const struct pubkey *next_per_commit_point, |
| 2529 | const struct htlc **changed_htlcs, |
| 2530 | const struct fee_states *fee_states, |
| 2531 | const struct height_states *blockheight_states) |
| 2532 | { |
| 2533 | u8 *msg; |
| 2534 | struct penalty_base *pbase; |
| 2535 | struct changed_htlc *changed = tal_arr(tmpctx, struct changed_htlc, 0); |
| 2536 | const struct bitcoin_tx *ptx = NULL; |
| 2537 | |
| 2538 | for (size_t i = 0; i < tal_count(changed_htlcs); i++) { |
| 2539 | struct changed_htlc c; |
| 2540 | const struct htlc *htlc = changed_htlcs[i]; |
| 2541 | |
| 2542 | status_debug("HTLC %"PRIu64"[%s] => %s", |
| 2543 | htlc->id, side_to_str(htlc_owner(htlc)), |
| 2544 | htlc_state_name(htlc->state)); |
| 2545 | |
| 2546 | c.id = changed_htlcs[i]->id; |
| 2547 | c.newstate = changed_htlcs[i]->state; |
| 2548 | tal_arr_expand(&changed, c); |
| 2549 | } |
| 2550 | |
| 2551 | pbase = penalty_base_by_commitnum(tmpctx, peer, revoke_num); |
| 2552 | |
| 2553 | if (pbase) { |
| 2554 | /* DTODO we need penalty tx's per splice candidate */ |
| 2555 | ptx = penalty_tx_create( |
| 2556 | NULL, peer->channel, peer->feerate_penalty, |
| 2557 | peer->final_index, peer->final_ext_key, |
| 2558 | peer->final_scriptpubkey, per_commitment_secret, |
| 2559 | &pbase->txid, pbase->outnum, pbase->amount, |
| 2560 | HSM_FD); |
| 2561 | } |
| 2562 | |
| 2563 | msg = towire_channeld_got_revoke(peer, revoke_num, per_commitment_secret, |
| 2564 | next_per_commit_point, fee_states, |
| 2565 | blockheight_states, changed, |
| 2566 | pbase, ptx); |
| 2567 | tal_free(ptx); |
| 2568 | return msg; |
| 2569 | } |
| 2570 | |
| 2571 | static void handle_peer_revoke_and_ack(struct peer *peer, const u8 *msg) |
| 2572 | { |
no test coverage detected