some initial testing 2023-08-channelmanager-no-serialize-testing-and-wips
authorMatt Corallo <git@bluematt.me>
Tue, 15 Aug 2023 05:02:53 +0000 (05:02 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 15 Aug 2023 05:02:53 +0000 (05:02 +0000)
lightning/src/ln/chanmon_update_fail_tests.rs
lightning/src/ln/channelmanager.rs

index 8f4ebdc58726130ac091c45a8154d1c89f29e18e..acc28cf4204495f340c0655d6d8a4e85390437f0 100644 (file)
@@ -2483,6 +2483,9 @@ fn do_channel_holding_cell_serialize(disconnect: bool, reload_a: bool) {
        expect_payment_claimable!(nodes[1], payment_hash_2, payment_secret_2, 100000);
 
        claim_payment(&nodes[0], &[&nodes[1]], payment_preimage_1);
+       // We fail here if we reloaded - the HTLC for this payment was in the holding cell at the time
+       // of the reload, so it wasn't visible in the channelmonitor and thus the outbound payment
+       // wasn't rehypothecated.
        claim_payment(&nodes[0], &[&nodes[1]], payment_preimage_2);
 }
 #[test]
index b7c7e03322725d2d34f957249f1fe049ac18b68f..e50d5d35194172e8b96da2674d74fde7352cf3c8 100644 (file)
@@ -8203,10 +8203,19 @@ where
                        }
                }
 
+let mut a = HashMap::new();
+for (k, payment) in pending_outbound_payments.iter() {
+       if let PendingOutboundPayment::Retryable { pending_amt_msat: 0, .. } = payment {
+               a.insert(k, payment);
+       }
+       if let PendingOutboundPayment::Fulfilled { .. } = payment {
+               a.insert(k, payment);
+       }
+}
                write_tlv_fields!(writer, {
-                       (1, pending_outbound_payments_no_retry, required),
-                       (2, pending_intercepted_htlcs, option),
-                       (3, pending_outbound_payments, required),
+                       (1, pending_outbound_payments_no_retry, required), // backwards compat
+                       (2, pending_intercepted_htlcs, option), // list - can it be per-channel?
+                       (3, a, required), // can we regenerate only?
                        (4, pending_claiming_payments, option),
                        (5, self.our_network_pubkey, required),
                        (6, monitor_update_blocked_actions_per_peer, option),
@@ -8821,7 +8830,7 @@ where
                        // 0.0.102+
                        for (_, monitor) in args.channel_monitors.iter() {
                                let counterparty_opt = id_to_peer.get(&monitor.get_funding_txo().0.to_channel_id());
-                               if counterparty_opt.is_none() {
+                               //if counterparty_opt.is_none() {
                                        for (htlc_source, (htlc, _)) in monitor.get_pending_or_resolved_outbound_htlcs() {
                                                if let HTLCSource::OutboundRoute { payment_id, session_priv, path, .. } = htlc_source {
                                                        if path.hops.is_empty() {
@@ -8915,7 +8924,7 @@ where
                                                        },
                                                }
                                        }
-                               }
+                               //}
 
                                // Whether the downstream channel was closed or not, try to re-apply any payment
                                // preimages from it which may be needed in upstream channels for forwarded