Skip to content

Commit 23d2ab7

Browse files
committed
move up updaing fee when freeing holding_cell
for fee to make pending_update_fee updated when building commitment tx
1 parent e1cf884 commit 23d2ab7

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/ln/channel.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,23 +1742,22 @@ impl Channel {
17421742
// case there is some strange way to hit duplicate HTLC removes.
17431743
return Ok(None);
17441744
}
1745+
let update_fee = if let Some(feerate) = self.holding_cell_update_fee {
1746+
self.pending_update_fee = self.holding_cell_update_fee.take();
1747+
Some(msgs::UpdateFee {
1748+
channel_id: self.channel_id,
1749+
feerate_per_kw: feerate as u32,
1750+
})
1751+
} else {
1752+
None
1753+
};
17451754
let (commitment_signed, monitor_update) = self.send_commitment_no_status_check()?;
17461755
Ok(Some((msgs::CommitmentUpdate {
17471756
update_add_htlcs,
17481757
update_fulfill_htlcs,
17491758
update_fail_htlcs,
17501759
update_fail_malformed_htlcs: Vec::new(),
1751-
update_fee: {
1752-
if let Some(feerate) = self.holding_cell_update_fee {
1753-
self.pending_update_fee = self.holding_cell_update_fee.take();
1754-
Some(msgs::UpdateFee {
1755-
channel_id: self.channel_id,
1756-
feerate_per_kw: feerate as u32,
1757-
})
1758-
} else {
1759-
None
1760-
}
1761-
},
1760+
update_fee: update_fee,
17621761
commitment_signed,
17631762
}, monitor_update)))
17641763
},

0 commit comments

Comments
 (0)