X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fmonitor_tests.rs;h=58878a9998c8a3b5aa2d87b8e14bc294c4574335;hb=1c9df02cbf51b6e6ac15f3d52da5f95f8b7beed2;hp=728752f97c310bc478abc213d165fc347a2db407;hpb=3dffe54258a374d15571d4ec72f5faa02477b770;p=rust-lightning diff --git a/lightning/src/ln/monitor_tests.rs b/lightning/src/ln/monitor_tests.rs index 728752f9..58878a99 100644 --- a/lightning/src/ln/monitor_tests.rs +++ b/lightning/src/ln/monitor_tests.rs @@ -2191,7 +2191,7 @@ fn test_anchors_aggregated_revoked_htlc_tx() { // Alice should see that Bob is trying to claim to HTLCs, so she should now try to claim them at // the second level instead. - let revoked_claims = { + let revoked_claim_transactions = { let txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().split_off(0); assert_eq!(txn.len(), 2); @@ -2205,10 +2205,14 @@ fn test_anchors_aggregated_revoked_htlc_tx() { check_spends!(revoked_htlc_claim, htlc_tx); } - txn + let mut revoked_claim_transaction_map = HashMap::new(); + for current_tx in txn.into_iter() { + revoked_claim_transaction_map.insert(current_tx.txid(), current_tx); + } + revoked_claim_transaction_map }; for node in &nodes { - mine_transactions(node, &revoked_claims.iter().collect::>()); + mine_transactions(node, &revoked_claim_transactions.values().collect::>()); } @@ -2234,7 +2238,8 @@ fn test_anchors_aggregated_revoked_htlc_tx() { let spend_tx = nodes[0].keys_manager.backing.spend_spendable_outputs( &[&outputs[0]], Vec::new(), Script::new_op_return(&[]), 253, None, &Secp256k1::new(), ).unwrap(); - check_spends!(spend_tx, revoked_claims[idx]); + + check_spends!(spend_tx, revoked_claim_transactions.get(&spend_tx.input[0].previous_output.txid).unwrap()); } else { panic!("unexpected event"); }