- /// Returns an unsigned transaction spending an anchor output of the commitment transaction, and
- /// any additional UTXOs sourced, to bump the commitment transaction's fee.
- fn build_anchor_tx(
- &self, claim_id: ClaimId, target_feerate_sat_per_1000_weight: u32,
- commitment_tx: &Transaction, anchor_descriptor: &AnchorDescriptor,
- ) -> Result<Transaction, ()> {
- let must_spend = vec![Input {
- outpoint: anchor_descriptor.outpoint,
- previous_utxo: anchor_descriptor.previous_utxo(),
- satisfaction_weight: commitment_tx.weight() as u64 + ANCHOR_INPUT_WITNESS_WEIGHT + EMPTY_SCRIPT_SIG_WEIGHT,
- }];
- let coin_selection = self.utxo_source.select_confirmed_utxos(
- claim_id, &must_spend, &[], target_feerate_sat_per_1000_weight,
- )?;
-
- let mut tx = Transaction {
- version: 2,
- lock_time: PackedLockTime::ZERO, // TODO: Use next best height.
- input: vec![anchor_descriptor.unsigned_tx_input()],
- output: vec![],
- };
- self.process_coin_selection(&mut tx, coin_selection);
- Ok(tx)
- }
-