Merge pull request #1144 from jkczyz/2021-10-invoice-payer-scoring
[rust-lightning] / lightning / src / ln / functional_tests.rs
index 564a9e5a09035f0bc9554e2d2f91d93f05650436..77d3f1d36a683c4eee90bcdf6e43075a31caddc2 100644 (file)
@@ -2659,7 +2659,7 @@ fn test_htlc_on_chain_success() {
        let mut first_claimed = false;
        for event in events {
                match event {
-                       Event::PaymentSent { payment_id: _, payment_preimage, payment_hash } => {
+                       Event::PaymentSent { payment_preimage, payment_hash, .. } => {
                                if payment_preimage == our_payment_preimage && payment_hash == payment_hash_1 {
                                        assert!(!first_claimed);
                                        first_claimed = true;
@@ -3350,7 +3350,7 @@ fn test_simple_peer_disconnect() {
                let events = nodes[0].node.get_and_clear_pending_events();
                assert_eq!(events.len(), 2);
                match events[0] {
-                       Event::PaymentSent { payment_id: _, payment_preimage, payment_hash } => {
+                       Event::PaymentSent { payment_preimage, payment_hash, .. } => {
                                assert_eq!(payment_preimage, payment_preimage_3);
                                assert_eq!(payment_hash, payment_hash_3);
                        },
@@ -3514,7 +3514,7 @@ fn do_test_drop_messages_peer_disconnect(messages_delivered: u8, simulate_broken
                let events_4 = nodes[0].node.get_and_clear_pending_events();
                assert_eq!(events_4.len(), 1);
                match events_4[0] {
-                       Event::PaymentSent { payment_id: _, ref payment_preimage, ref payment_hash } => {
+                       Event::PaymentSent { ref payment_preimage, ref payment_hash, .. } => {
                                assert_eq!(payment_preimage_1, *payment_preimage);
                                assert_eq!(payment_hash_1, *payment_hash);
                        },
@@ -3555,7 +3555,7 @@ fn do_test_drop_messages_peer_disconnect(messages_delivered: u8, simulate_broken
                        let events_4 = nodes[0].node.get_and_clear_pending_events();
                        assert_eq!(events_4.len(), 1);
                        match events_4[0] {
-                               Event::PaymentSent { payment_id: _, ref payment_preimage, ref payment_hash } => {
+                               Event::PaymentSent { ref payment_preimage, ref payment_hash, .. } => {
                                        assert_eq!(payment_preimage_1, *payment_preimage);
                                        assert_eq!(payment_hash_1, *payment_hash);
                                },
@@ -3790,7 +3790,7 @@ fn test_drop_messages_peer_disconnect_dual_htlc() {
                        let events_3 = nodes[0].node.get_and_clear_pending_events();
                        assert_eq!(events_3.len(), 1);
                        match events_3[0] {
-                               Event::PaymentSent { payment_id: _, ref payment_preimage, ref payment_hash } => {
+                               Event::PaymentSent { ref payment_preimage, ref payment_hash, .. } => {
                                        assert_eq!(*payment_preimage, payment_preimage_1);
                                        assert_eq!(*payment_hash, payment_hash_1);
                                },
@@ -5059,7 +5059,7 @@ fn test_duplicate_payment_hash_one_failure_one_success() {
 
        let events = nodes[0].node.get_and_clear_pending_events();
        match events[0] {
-               Event::PaymentSent { payment_id: _, ref payment_preimage, ref payment_hash } => {
+               Event::PaymentSent { ref payment_preimage, ref payment_hash, .. } => {
                        assert_eq!(*payment_preimage, our_payment_preimage);
                        assert_eq!(*payment_hash, duplicate_payment_hash);
                }
@@ -5572,7 +5572,7 @@ fn do_htlc_claim_local_commitment_only(use_dust: bool) {
        let events = nodes[0].node.get_and_clear_pending_events();
        assert_eq!(events.len(), 1);
        match events[0] {
-               Event::PaymentSent { payment_id: _, payment_preimage, payment_hash } => {
+               Event::PaymentSent { payment_preimage, payment_hash, .. } => {
                        assert_eq!(payment_preimage, our_payment_preimage);
                        assert_eq!(payment_hash, our_payment_hash);
                },
@@ -6002,7 +6002,7 @@ fn test_free_and_fail_holding_cell_htlcs() {
        let events = nodes[0].node.get_and_clear_pending_events();
        assert_eq!(events.len(), 1);
        match events[0] {
-               Event::PaymentSent { payment_id: _, ref payment_preimage, ref payment_hash } => {
+               Event::PaymentSent { ref payment_preimage, ref payment_hash, .. } => {
                        assert_eq!(*payment_preimage, payment_preimage_1);
                        assert_eq!(*payment_hash, payment_hash_1);
                }
@@ -7161,7 +7161,7 @@ fn test_check_htlc_underpaying() {
        // Create some initial channels
        create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
 
-       let scorer = Scorer::new(0);
+       let scorer = Scorer::with_fixed_penalty(0);
        let payee = Payee::new(nodes[1].node.get_our_node_id()).with_features(InvoiceFeatures::known());
        let route = get_route(&nodes[0].node.get_our_node_id(), &payee, &nodes[0].net_graph_msg_handler.network_graph, None, 10_000, TEST_FINAL_CLTV, nodes[0].logger, &scorer).unwrap();
        let (_, our_payment_hash, _) = get_payment_preimage_hash!(nodes[0]);
@@ -7561,7 +7561,7 @@ fn test_bump_penalty_txn_on_revoked_htlcs() {
        let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1000000, 59000000, InitFeatures::known(), InitFeatures::known());
        // Lock HTLC in both directions (using a slightly lower CLTV delay to provide timely RBF bumps)
        let payee = Payee::new(nodes[1].node.get_our_node_id()).with_features(InvoiceFeatures::known());
-       let scorer = Scorer::new(0);
+       let scorer = Scorer::with_fixed_penalty(0);
        let route = get_route(&nodes[0].node.get_our_node_id(), &payee, &nodes[0].net_graph_msg_handler.network_graph,
                None, 3_000_000, 50, nodes[0].logger, &scorer).unwrap();
        let payment_preimage = send_along_route(&nodes[0], route, &[&nodes[1]], 3_000_000).0;
@@ -9061,7 +9061,7 @@ fn test_keysend_payments_to_public_node() {
                final_value_msat: 10000,
                final_cltv_expiry_delta: 40,
        };
-       let scorer = Scorer::new(0);
+       let scorer = Scorer::with_fixed_penalty(0);
        let route = find_route(&payer_pubkey, &params, &network_graph, None, nodes[0].logger, &scorer).unwrap();
 
        let test_preimage = PaymentPreimage([42; 32]);
@@ -9095,7 +9095,7 @@ fn test_keysend_payments_to_private_node() {
        };
        let network_graph = &nodes[0].net_graph_msg_handler.network_graph;
        let first_hops = nodes[0].node.list_usable_channels();
-       let scorer = Scorer::new(0);
+       let scorer = Scorer::with_fixed_penalty(0);
        let route = find_route(
                &payer_pubkey, &params, &network_graph, Some(&first_hops.iter().collect::<Vec<_>>()),
                nodes[0].logger, &scorer