Merge pull request #1507 from ViktorTigerstrom/2022-05-store-channels-per-peer
[rust-lightning] / lightning / src / ln / monitor_tests.rs
index 1cb32bed08dc42e2cbb7371856343d14d8d21e35..0ad392131acecf77e2174b0338721cd5db395325 100644 (file)
@@ -158,8 +158,8 @@ fn chanmon_claim_value_coop_close() {
        let funding_outpoint = OutPoint { txid: funding_tx.txid(), index: 0 };
        assert_eq!(funding_outpoint.to_channel_id(), chan_id);
 
-       let chan_feerate = get_feerate!(nodes[0], chan_id) as u64;
-       let opt_anchors = get_opt_anchors!(nodes[0], chan_id);
+       let chan_feerate = get_feerate!(nodes[0], nodes[1], chan_id) as u64;
+       let opt_anchors = get_opt_anchors!(nodes[0], nodes[1], chan_id);
 
        assert_eq!(vec![Balance::ClaimableOnChannelClose {
                        claimable_amount_satoshis: 1_000_000 - 1_000 - chan_feerate * channel::commitment_tx_base_weight(opt_anchors) / 1000
@@ -269,8 +269,8 @@ fn do_test_claim_value_force_close(prev_commitment_tx: bool) {
 
        let htlc_cltv_timeout = nodes[0].best_block_info().1 + TEST_FINAL_CLTV + 1; // Note ChannelManager adds one to CLTV timeouts for safety
 
-       let chan_feerate = get_feerate!(nodes[0], chan_id) as u64;
-       let opt_anchors = get_opt_anchors!(nodes[0], chan_id);
+       let chan_feerate = get_feerate!(nodes[0], nodes[1], chan_id) as u64;
+       let opt_anchors = get_opt_anchors!(nodes[0], nodes[1], chan_id);
 
        let remote_txn = get_local_commitment_txn!(nodes[1], chan_id);
        // Before B receives the payment preimage, it only suggests the push_msat value of 1_000 sats
@@ -624,8 +624,8 @@ fn test_balances_on_local_commitment_htlcs() {
        check_added_monitors!(nodes[1], 1);
        expect_payment_claimed!(nodes[1], payment_hash_2, 20_000_000);
 
-       let chan_feerate = get_feerate!(nodes[0], chan_id) as u64;
-       let opt_anchors = get_opt_anchors!(nodes[0], chan_id);
+       let chan_feerate = get_feerate!(nodes[0], nodes[1], chan_id) as u64;
+       let opt_anchors = get_opt_anchors!(nodes[0], nodes[1], chan_id);
 
        // Get nodes[0]'s commitment transaction and HTLC-Timeout transactions
        let as_txn = get_local_commitment_txn!(nodes[0], chan_id);
@@ -776,8 +776,8 @@ fn test_no_preimage_inbound_htlc_balances() {
        let to_a_failed_payment_hash = route_payment(&nodes[1], &[&nodes[0]], 20_000_000).1;
        let htlc_cltv_timeout = nodes[0].best_block_info().1 + TEST_FINAL_CLTV + 1; // Note ChannelManager adds one to CLTV timeouts for safety
 
-       let chan_feerate = get_feerate!(nodes[0], chan_id) as u64;
-       let opt_anchors = get_opt_anchors!(nodes[0], chan_id);
+       let chan_feerate = get_feerate!(nodes[0], nodes[1], chan_id) as u64;
+       let opt_anchors = get_opt_anchors!(nodes[0], nodes[1], chan_id);
 
        // Both A and B will have an HTLC that's claimable on timeout and one that's claimable if they
        // receive the preimage. These will remain the same through the channel closure and until the
@@ -1052,9 +1052,9 @@ fn do_test_revoked_counterparty_commitment_balances(confirm_htlc_spend_first: bo
 
        // Get the latest commitment transaction from A and then update the fee to revoke it
        let as_revoked_txn = get_local_commitment_txn!(nodes[0], chan_id);
-       let opt_anchors = get_opt_anchors!(nodes[0], chan_id);
+       let opt_anchors = get_opt_anchors!(nodes[0], nodes[1], chan_id);
 
-       let chan_feerate = get_feerate!(nodes[0], chan_id) as u64;
+       let chan_feerate = get_feerate!(nodes[0], nodes[1], chan_id) as u64;
 
        let missing_htlc_cltv_timeout = nodes[0].best_block_info().1 + TEST_FINAL_CLTV + 1; // Note ChannelManager adds one to CLTV timeouts for safety
        let missing_htlc_payment_hash = route_payment(&nodes[1], &[&nodes[0]], 2_000_000).1;
@@ -1288,8 +1288,8 @@ fn test_revoked_counterparty_htlc_tx_balances() {
 
        claim_payment(&nodes[0], &[&nodes[1]], payment_preimage);
 
-       let chan_feerate = get_feerate!(nodes[0], chan_id) as u64;
-       let opt_anchors = get_opt_anchors!(nodes[0], chan_id);
+       let chan_feerate = get_feerate!(nodes[0], nodes[1], chan_id) as u64;
+       let opt_anchors = get_opt_anchors!(nodes[0], nodes[1], chan_id);
 
        // B will generate an HTLC-Success from its revoked commitment tx
        mine_transaction(&nodes[1], &revoked_local_txn[0]);
@@ -1508,8 +1508,8 @@ fn test_revoked_counterparty_aggregated_claims() {
        check_spends!(as_revoked_txn[0], funding_tx);
        check_spends!(as_revoked_txn[1], as_revoked_txn[0]); // The HTLC-Claim transaction
 
-       let opt_anchors = get_opt_anchors!(nodes[0], chan_id);
-       let chan_feerate = get_feerate!(nodes[0], chan_id) as u64;
+       let opt_anchors = get_opt_anchors!(nodes[0], nodes[1], chan_id);
+       let chan_feerate = get_feerate!(nodes[0], nodes[1], chan_id) as u64;
 
        {
                let mut feerate = chanmon_cfgs[0].fee_estimator.sat_per_kw.lock().unwrap();