- if let &Some(ref local_tx) = &self.current_local_signed_commitment_tx {
- let mut res = vec![local_tx.tx.with_valid_witness().clone()];
- res.append(&mut self.broadcast_by_local_state(local_tx).0);
- // We throw away the generated waiting_first_conf data as we aren't (yet) confirmed and we don't actually know what the caller wants to do.
- // The data will be re-generated and tracked in check_spend_local_transaction if we get a confirmation.
- res
- } else {
- Vec::new()
+ Vec::new()
+ }
+
+ /// Unsafe test-only version of get_latest_local_commitment_txn used by our test framework
+ /// to bypass LocalCommitmentTransaction state update lockdown after signature and generate
+ /// revoked commitment transaction.
+ #[cfg(test)]
+ pub fn unsafe_get_latest_local_commitment_txn(&mut self) -> Vec<Transaction> {
+ log_trace!(self, "Getting signed copy of latest local commitment transaction!");
+ if let Some(commitment_tx) = self.onchain_tx_handler.get_fully_signed_copy_local_tx(self.channel_value_satoshis.unwrap()) {
+ let mut res = vec![commitment_tx];
+ if let &Some(ref local_tx) = &self.current_local_signed_commitment_tx {
+ let mut htlc_txn = self.broadcast_by_local_state(res.get(0).unwrap(), local_tx).0;
+ res.append(&mut htlc_txn);
+ }
+ return res