Skip to content

Commit ee7cfa5

Browse files
committed
Swap loop and condition order to avoid looping unnecessarily
1 parent a265fc2 commit ee7cfa5

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
@@ -4419,8 +4419,8 @@ impl<Signer: Sign> Channel<Signer> {
44194419
txdata: &TransactionData, genesis_block_hash: BlockHash, node_pk: PublicKey, logger: &L)
44204420
-> Result<(Option<msgs::FundingLocked>, Option<msgs::AnnouncementSignatures>), ClosureReason> where L::Target: Logger {
44214421
let non_shutdown_state = self.channel_state & (!MULTI_STATE_FLAGS);
4422-
for &(index_in_block, tx) in txdata.iter() {
4423-
if let Some(funding_txo) = self.get_funding_txo() {
4422+
if let Some(funding_txo) = self.get_funding_txo() {
4423+
for &(index_in_block, tx) in txdata.iter() {
44244424
// If we haven't yet sent a funding_locked, but are in FundingSent (ignoring
44254425
// whether they've sent a funding_locked or not), check if we should send one.
44264426
if non_shutdown_state & !(ChannelState::TheirFundingLocked as u32) == ChannelState::FundingSent as u32 {

0 commit comments

Comments
 (0)