| 3740 | } |
| 3741 | |
| 3742 | static void handle_unknown_commitment(const struct tx_parts *tx, |
| 3743 | u32 tx_blockheight, |
| 3744 | const struct pubkey *possible_remote_per_commitment_point, |
| 3745 | const struct basepoints basepoints[NUM_SIDES], |
| 3746 | struct tracked_output **outs) |
| 3747 | { |
| 3748 | int to_us_output = -1; |
| 3749 | /* We have two possible local scripts, depending on options */ |
| 3750 | u8 *local_scripts[2]; |
| 3751 | struct htlcs_info *htlcs_info; |
| 3752 | |
| 3753 | onchain_annotate_txin(&tx->txid, 0, TX_CHANNEL_UNILATERAL | TX_THEIRS); |
| 3754 | |
| 3755 | resolved_by_other(outs[0], &tx->txid, UNKNOWN_UNILATERAL); |
| 3756 | |
| 3757 | /* This is the not-option_static_remotekey case, if we got a hint |
| 3758 | * from them about the per-commitment point */ |
| 3759 | if (possible_remote_per_commitment_point) { |
| 3760 | struct keyset *ks = tal(tmpctx, struct keyset); |
| 3761 | if (!derive_keyset(possible_remote_per_commitment_point, |
| 3762 | &basepoints[REMOTE], |
| 3763 | &basepoints[LOCAL], |
| 3764 | false, |
| 3765 | ks)) |
| 3766 | status_failed(STATUS_FAIL_INTERNAL_ERROR, |
| 3767 | "Deriving keyset for possible_remote_per_commitment_point %s", |
| 3768 | type_to_string(tmpctx, struct pubkey, |
| 3769 | possible_remote_per_commitment_point)); |
| 3770 | |
| 3771 | local_scripts[0] = scriptpubkey_p2wpkh(tmpctx, |
| 3772 | &ks->other_payment_key); |
| 3773 | } else { |
| 3774 | local_scripts[0] = NULL; |
| 3775 | } |
| 3776 | |
| 3777 | /* For option_will_fund, we need to figure out what CSV lock was used */ |
| 3778 | for (size_t csv = 1; csv <= LEASE_RATE_DURATION; csv++) { |
| 3779 | |
| 3780 | /* Other possible local script is for option_static_remotekey */ |
| 3781 | local_scripts[1] = scriptpubkey_to_remote(tmpctx, |
| 3782 | &basepoints[LOCAL].payment, |
| 3783 | csv); |
| 3784 | |
| 3785 | for (size_t i = 0; i < tal_count(tx->outputs); i++) { |
| 3786 | struct tracked_output *out; |
| 3787 | struct amount_asset asset = wally_tx_output_get_amount(tx->outputs[i]); |
| 3788 | struct amount_sat amt; |
| 3789 | int which_script; |
| 3790 | struct bitcoin_outpoint outpoint; |
| 3791 | |
| 3792 | assert(amount_asset_is_main(&asset)); |
| 3793 | amt = amount_asset_to_sat(&asset); |
| 3794 | |
| 3795 | outpoint.txid = tx->txid; |
| 3796 | outpoint.n = i; |
| 3797 | |
| 3798 | /* Elements can have empty output scripts (fee output) */ |
| 3799 | if (local_scripts[0] |
no test coverage detected