Skip to content

Commit f4d944f

Browse files
committed
Swap loop and condition order to avoid looping unnecessarily
1 parent df39af0 commit f4d944f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lightning/src/ln/channel.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4251,8 +4251,8 @@ impl<Signer: Sign> Channel<Signer> {
42514251
txdata: &TransactionData, genesis_block_hash: BlockHash, node_pk: PublicKey, logger: &L)
42524252
-> Result<(Option<msgs::FundingLocked>, Option<msgs::AnnouncementSignatures>), ClosureReason> where L::Target: Logger {
42534253
let non_shutdown_state = self.channel_state & (!MULTI_STATE_FLAGS);
4254-
for &(index_in_block, tx) in txdata.iter() {
4255-
if let Some(funding_txo) = self.get_funding_txo() {
4254+
if let Some(funding_txo) = self.get_funding_txo() {
4255+
for &(index_in_block, tx) in txdata.iter() {
42564256
// If we haven't yet sent a funding_locked, but are in FundingSent (ignoring
42574257
// whether they've sent a funding_locked or not), check if we should send one.
42584258
if non_shutdown_state & !(ChannelState::TheirFundingLocked as u32) == ChannelState::FundingSent as u32 {

0 commit comments

Comments
 (0)