Compute InflightHtlcs from available information in ChannelManager
[rust-lightning] / lightning / src / ln / monitor_tests.rs
index 1e825c4625dc7ee3b2110825f8d6f153f0f0fda7..2916855c0ab34d27b1352ac57e594ad31b090cc9 100644 (file)
@@ -9,22 +9,22 @@
 
 //! Further functional tests which test blockchain reorganizations.
 
-use chain::channelmonitor::{ANTI_REORG_DELAY, Balance};
-use chain::transaction::OutPoint;
-use chain::chaininterface::LowerBoundedFeeEstimator;
-use ln::channel;
-use ln::channelmanager::{self, BREAKDOWN_TIMEOUT};
-use ln::msgs::ChannelMessageHandler;
-use util::events::{Event, MessageSendEvent, MessageSendEventsProvider, ClosureReason, HTLCDestination};
+use crate::chain::channelmonitor::{ANTI_REORG_DELAY, Balance};
+use crate::chain::transaction::OutPoint;
+use crate::chain::chaininterface::LowerBoundedFeeEstimator;
+use crate::ln::channel;
+use crate::ln::channelmanager::{self, BREAKDOWN_TIMEOUT, PaymentId};
+use crate::ln::msgs::ChannelMessageHandler;
+use crate::util::events::{Event, MessageSendEvent, MessageSendEventsProvider, ClosureReason, HTLCDestination};
 
 use bitcoin::blockdata::script::Builder;
 use bitcoin::blockdata::opcodes;
 use bitcoin::secp256k1::Secp256k1;
 use bitcoin::Transaction;
 
-use prelude::*;
+use crate::prelude::*;
 
-use ln::functional_test_utils::*;
+use crate::ln::functional_test_utils::*;
 
 #[test]
 fn chanmon_fail_from_stale_commitment() {
@@ -52,7 +52,7 @@ fn chanmon_fail_from_stale_commitment() {
        let (update_a, _, chan_id_2, _) = create_announced_chan_between_nodes(&nodes, 1, 2, channelmanager::provided_init_features(), channelmanager::provided_init_features());
 
        let (route, payment_hash, _, payment_secret) = get_route_and_payment_hash!(nodes[0], nodes[2], 1_000_000);
-       nodes[0].node.send_payment(&route, payment_hash, &Some(payment_secret)).unwrap();
+       nodes[0].node.send_payment(&route, payment_hash, &Some(payment_secret), PaymentId(payment_hash.0)).unwrap();
        check_added_monitors!(nodes[0], 1);
 
        let bs_txn = get_local_commitment_txn!(nodes[1], chan_id_2);
@@ -598,7 +598,7 @@ fn test_balances_on_local_commitment_htlcs() {
 
        let (route, payment_hash, _, payment_secret) = get_route_and_payment_hash!(nodes[0], nodes[1], 10_000_000);
        let htlc_cltv_timeout = nodes[0].best_block_info().1 + TEST_FINAL_CLTV + 1; // Note ChannelManager adds one to CLTV timeouts for safety
-       nodes[0].node.send_payment(&route, payment_hash, &Some(payment_secret)).unwrap();
+       nodes[0].node.send_payment(&route, payment_hash, &Some(payment_secret), PaymentId(payment_hash.0)).unwrap();
        check_added_monitors!(nodes[0], 1);
 
        let updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
@@ -609,7 +609,7 @@ fn test_balances_on_local_commitment_htlcs() {
        expect_payment_received!(nodes[1], payment_hash, payment_secret, 10_000_000);
 
        let (route_2, payment_hash_2, payment_preimage_2, payment_secret_2) = get_route_and_payment_hash!(nodes[0], nodes[1], 20_000_000);
-       nodes[0].node.send_payment(&route_2, payment_hash_2, &Some(payment_secret_2)).unwrap();
+       nodes[0].node.send_payment(&route_2, payment_hash_2, &Some(payment_secret_2), PaymentId(payment_hash_2.0)).unwrap();
        check_added_monitors!(nodes[0], 1);
 
        let updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());