Merge pull request #441 from TheBlueMatt/2020-01-mpp
[rust-lightning] / lightning / src / ln / reorg_tests.rs
index 708beac444da205b2a65213a9351119cce44c3dd..6b2c5d43234125ecd1ce07bc0292eb71407fbc62 100644 (file)
@@ -39,7 +39,7 @@ fn do_test_onchain_htlc_reorg(local_commitment: bool, claim: bool) {
        let (our_payment_preimage, our_payment_hash) = route_payment(&nodes[0], &[&nodes[1], &nodes[2]], 1000000);
 
        // Provide preimage to node 2 by claiming payment
-       nodes[2].node.claim_funds(our_payment_preimage, 1000000);
+       nodes[2].node.claim_funds(our_payment_preimage, &None, 1000000);
        check_added_monitors!(nodes[2], 1);
        get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
 
@@ -47,7 +47,7 @@ fn do_test_onchain_htlc_reorg(local_commitment: bool, claim: bool) {
        let mut header = BlockHeader { version: 0x2000_0000, prev_blockhash: Default::default(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
        let claim_txn = if local_commitment {
                // Broadcast node 1 commitment txn to broadcast the HTLC-Timeout
-               let node_1_commitment_txn = nodes[1].node.channel_state.lock().unwrap().by_id.get_mut(&chan_2.2).unwrap().channel_monitor().get_latest_local_commitment_txn();
+               let node_1_commitment_txn = get_local_commitment_txn!(nodes[1], chan_2.2);
                assert_eq!(node_1_commitment_txn.len(), 2); // 1 local commitment tx, 1 Outbound HTLC-Timeout
                assert_eq!(node_1_commitment_txn[0].output.len(), 2); // to-self and Offered HTLC (to-remote/to-node-3 is dust)
                check_spends!(node_1_commitment_txn[0], chan_2.3);
@@ -71,7 +71,7 @@ fn do_test_onchain_htlc_reorg(local_commitment: bool, claim: bool) {
                vec![node_1_commitment_txn[0].clone(), node_2_commitment_txn[0].clone()]
        } else {
                // Broadcast node 2 commitment txn
-               let node_2_commitment_txn = nodes[2].node.channel_state.lock().unwrap().by_id.get_mut(&chan_2.2).unwrap().channel_monitor().get_latest_local_commitment_txn();
+               let node_2_commitment_txn = get_local_commitment_txn!(nodes[2], chan_2.2);
                assert_eq!(node_2_commitment_txn.len(), 2); // 1 local commitment tx, 1 Received HTLC-Claim
                assert_eq!(node_2_commitment_txn[0].output.len(), 2); // to-remote and Received HTLC (to-self is dust)
                check_spends!(node_2_commitment_txn[0], chan_2.3);