+ #[cfg(anchors)]
+ return inputs.find_map(|input| match input {
+ // Commitment inputs with anchors support are the only untractable inputs supported
+ // thus far that require external funding.
+ PackageSolvingData::HolderFundingOutput(..) => {
+ debug_assert_eq!(tx.txid(), self.holder_commitment.trust().txid(),
+ "Holder commitment transaction mismatch");
+ // We'll locate an anchor output we can spend within the commitment transaction.
+ let funding_pubkey = &self.channel_transaction_parameters.holder_pubkeys.funding_pubkey;
+ match chan_utils::get_anchor_output(&tx, funding_pubkey) {
+ // An anchor output was found, so we should yield a funding event externally.
+ Some((idx, _)) => {
+ // TODO: Use a lower confirmation target when both our and the
+ // counterparty's latest commitment don't have any HTLCs present.
+ let conf_target = ConfirmationTarget::HighPriority;
+ let package_target_feerate_sat_per_1000_weight = cached_request
+ .compute_package_feerate(fee_estimator, conf_target);
+ Some((
+ new_timer,
+ package_target_feerate_sat_per_1000_weight as u64,
+ OnchainClaim::Event(ClaimEvent::BumpCommitment {
+ package_target_feerate_sat_per_1000_weight,
+ commitment_tx: tx.clone(),
+ anchor_output_idx: idx,
+ }),
+ ))
+ },
+ // An anchor output was not found. There's nothing we can do other than
+ // attempt to broadcast the transaction with its current fee rate and hope
+ // it confirms. This is essentially the same behavior as a commitment
+ // transaction without anchor outputs.
+ None => Some((None, 0, OnchainClaim::Tx(tx.clone()))),
+ }
+ },
+ _ => {
+ debug_assert!(false, "Only HolderFundingOutput inputs should be untractable and require external funding");
+ None
+ },
+ });