- let mut claim_txn: Vec<_> = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap().drain(..).filter(|tx| tx.input.iter().any(|inp| inp.previous_output.txid == as_revoked_txn[0].txid())).collect();
- // Currently the revoked commitment outputs are all claimed in one aggregated transaction
- assert_eq!(claim_txn.len(), 1);
- assert_eq!(claim_txn[0].input.len(), 3);
- check_spends!(claim_txn[0], as_revoked_txn[0]);
+ let mut claim_txn = nodes[1].tx_broadcaster.txn_broadcast();
+ assert_eq!(claim_txn.len(), if anchors { 2 } else { 1 });
+ let revoked_to_self_claim = if anchors {
+ assert_eq!(claim_txn[0].input.len(), 1);
+ assert_eq!(claim_txn[0].input[0].previous_output.vout, 5); // Separate to_remote claim
+ check_spends!(claim_txn[0], as_revoked_txn[0]);
+ assert_eq!(claim_txn[1].input.len(), 2);
+ assert_eq!(claim_txn[1].input[0].previous_output.vout, 2);
+ assert_eq!(claim_txn[1].input[1].previous_output.vout, 3);
+ check_spends!(claim_txn[1], as_revoked_txn[0]);
+ Some(claim_txn.remove(0))
+ } else {
+ assert_eq!(claim_txn[0].input.len(), 3);
+ assert_eq!(claim_txn[0].input[0].previous_output.vout, 3);
+ assert_eq!(claim_txn[0].input[1].previous_output.vout, 0);
+ assert_eq!(claim_txn[0].input[2].previous_output.vout, 1);
+ check_spends!(claim_txn[0], as_revoked_txn[0]);
+ None
+ };