]> git.bitcoin.ninja Git - rust-lightning/commitdiff
PendingHTLCsForwardable really should just be upstreamed.
authorMatt Corallo <git@bluematt.me>
Wed, 25 Jul 2018 02:08:18 +0000 (22:08 -0400)
committerMatt Corallo <git@bluematt.me>
Wed, 25 Jul 2018 02:33:10 +0000 (22:33 -0400)
This is just a comment/docs/function rename change

fuzz/fuzz_targets/full_stack_target.rs
src/ln/channelmanager.rs
src/ln/peer_handler.rs
src/util/events.rs

index 59f9d2bb47cc32b3e4b9f9b1cedb8a5d7c02bb19..6fdac8ad24e080034613b3440cba556db3e5b691 100644 (file)
@@ -263,7 +263,7 @@ pub fn do_test(data: &[u8]) {
                        },
                        7 => {
                                if should_forward {
-                                       channelmanager.process_pending_htlc_forward();
+                                       channelmanager.process_pending_htlc_forwards();
                                        handler.process_events();
                                        should_forward = false;
                                }
index 174f63cc76cbff7c95f212d79fc83f7c92c59c1e..8eb91ea5dc6e28b469dfb7967d84b450ff38fbeb 100644 (file)
@@ -766,7 +766,10 @@ impl ChannelManager {
                }))
        }
 
-       pub fn process_pending_htlc_forward(&self) {
+       /// Processes HTLCs which are pending waiting on random forward delay.
+       /// Should only really ever be called in response to an PendingHTLCsForwardable event.
+       /// Will likely generate further events.
+       pub fn process_pending_htlc_forwards(&self) {
                let mut new_events = Vec::new();
                let mut failed_forwards = Vec::new();
                {
@@ -2359,7 +2362,7 @@ mod tests {
                        };
 
                        node.node.channel_state.lock().unwrap().next_forward = Instant::now();
-                       node.node.process_pending_htlc_forward();
+                       node.node.process_pending_htlc_forwards();
 
                        let mut events_2 = node.node.get_and_clear_pending_events();
                        assert_eq!(events_2.len(), 1);
index 7fde10d0908d86400fe8a4ca9df47a00a76884d0..7e213c037dc6be81ac550cd5b383d75b714d94be 100644 (file)
@@ -628,11 +628,8 @@ impl<Descriptor: SocketDescriptor> PeerManager<Descriptor> {
                                        Event::PaymentReceived {..} => { /* Hand upstream */ },
                                        Event::PaymentSent {..} => { /* Hand upstream */ },
                                        Event::PaymentFailed {..} => { /* Hand upstream */ },
+                                       Event::PendingHTLCsForwardable {..} => { /* Hand upstream */ },
 
-                                       Event::PendingHTLCsForwardable {..} => {
-                                               //TODO: Handle upstream in some confused form so that upstream just knows
-                                               //to call us somehow?
-                                       },
                                        Event::SendOpenChannel { ref node_id, ref msg } => {
                                                let (mut descriptor, peer) = get_peer_for_forwarding!(node_id, {
                                                                //TODO: Drop the pending channel? (or just let it timeout, but that sucks)
index fd801e4111ed6f3c6b58dcea72f0c7ff1534b116..e8330b7e29ba9877449bda22641f6faa726c737b 100644 (file)
@@ -46,13 +46,13 @@ pub enum Event {
        PaymentFailed {
                payment_hash: [u8; 32],
        },
-
-       // Events indicating the network loop should send a message to a peer:
        /// Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a
        /// time in the future.
        PendingHTLCsForwardable {
                time_forwardable: Instant,
        },
+
+       // Events indicating the network loop should send a message to a peer:
        /// Used to indicate that we've initialted a channel open and should send the open_channel
        /// message provided to the given peer
        SendOpenChannel {