]> git.bitcoin.ninja Git - rust-lightning/commit
Refactor forward_htlcs to return whether to push a forward event
authorWilmer Paulino <wilmer@wilmerpaulino.com>
Fri, 8 Mar 2024 07:30:18 +0000 (23:30 -0800)
committerWilmer Paulino <wilmer@wilmerpaulino.com>
Wed, 27 Mar 2024 21:28:05 +0000 (14:28 -0700)
commita6c912843456fb9521252179864e7501f112ebf6
tree2a825e209ab5c95329382977b6fc57bd4216d36a
parent7fe25829ed2ddce400af1d7f459f48f10288a3ef
Refactor forward_htlcs to return whether to push a forward event

When decoding pending `update_add_htlc` onions, we may need to forward
HTLCs using `ChannelManager::forward_htlcs`. This may end up queueing a
`PendingHTLCsForwardable` event, but we're only decoding these pending
onions as a result of handling a `PendingHTLCsForwardable`, so we
shouldn't have to queue another one and wait for it to be handled. By
having a `forward_htlcs` variant that does not push the forward event,
we can ignore the forward event push when forwarding HTLCs which we just
decoded the onion for.
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_test_utils.rs
lightning/src/ln/functional_tests.rs