@@ -1733,17 +1733,12 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1733
1733
self . commit_tx_fee_msat ( their_acked_htlcs + addl_htlcs)
1734
1734
}
1735
1735
1736
- pub fn update_add_htlc < F > ( & mut self , msg : & msgs:: UpdateAddHTLC , mut pending_forward_state : PendingHTLCStatus , create_pending_htlc_status : F ) -> Result < ( ) , ChannelError >
1736
+ pub fn update_add_htlc < F > ( & mut self , msg : & msgs:: UpdateAddHTLC , mut pending_forward_status : PendingHTLCStatus , create_pending_htlc_status : F ) -> Result < ( ) , ChannelError >
1737
1737
where F : for < ' a > Fn ( & ' a Self , PendingHTLCStatus , u16 ) -> PendingHTLCStatus {
1738
1738
// We can't accept HTLCs sent after we've sent a shutdown.
1739
1739
let local_sent_shutdown = ( self . channel_state & ( ChannelState :: ChannelFunded as u32 | ChannelState :: LocalShutdownSent as u32 ) ) != ( ChannelState :: ChannelFunded as u32 ) ;
1740
1740
if local_sent_shutdown {
1741
- // TODO: Note that |20 is defined as "channel FROM the processing
1742
- // node has been disabled" (emphasis mine), which seems to imply
1743
- // that we can't return |20 for an inbound channel being disabled.
1744
- // This probably needs a spec update but should definitely be
1745
- // allowed.
1746
- pending_forward_state = create_pending_htlc_status ( self , pending_forward_state, 0x1000 |20 ) ;
1741
+ pending_forward_status = create_pending_htlc_status ( self , pending_forward_status, 0x1000 |20 ) ;
1747
1742
}
1748
1743
// If the remote has sent a shutdown prior to adding this HTLC, then they are in violation of the spec.
1749
1744
let remote_sent_shutdown = ( self . channel_state & ( ChannelState :: ChannelFunded as u32 | ChannelState :: RemoteShutdownSent as u32 ) ) != ( ChannelState :: ChannelFunded as u32 ) ;
@@ -1823,9 +1818,9 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1823
1818
// being sensitive to fee spikes.
1824
1819
let remote_fee_cost_incl_stuck_buffer_msat = 2 * self . next_remote_commit_tx_fee_msat ( 1 + 1 ) ;
1825
1820
if pending_remote_value_msat - msg. amount_msat - chan_reserve_msat < remote_fee_cost_incl_stuck_buffer_msat {
1826
- // Note that if the pending_forward_state is not updated here, then it's because we're already failing
1821
+ // Note that if the pending_forward_status is not updated here, then it's because we're already failing
1827
1822
// the HTLC, i.e. its status is already set to failing.
1828
- pending_forward_state = create_pending_htlc_status ( self , pending_forward_state , 0x1000 |7 ) ;
1823
+ pending_forward_status = create_pending_htlc_status ( self , pending_forward_status , 0x1000 |7 ) ;
1829
1824
}
1830
1825
} else {
1831
1826
// Check that they won't violate our local required channel reserve by adding this HTLC.
@@ -1845,7 +1840,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1845
1840
}
1846
1841
1847
1842
if self . channel_state & ChannelState :: LocalShutdownSent as u32 != 0 {
1848
- if let PendingHTLCStatus :: Forward ( _) = pending_forward_state {
1843
+ if let PendingHTLCStatus :: Forward ( _) = pending_forward_status {
1849
1844
panic ! ( "ChannelManager shouldn't be trying to add a forwardable HTLC after we've started closing" ) ;
1850
1845
}
1851
1846
}
@@ -1857,7 +1852,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
1857
1852
amount_msat : msg. amount_msat ,
1858
1853
payment_hash : msg. payment_hash ,
1859
1854
cltv_expiry : msg. cltv_expiry ,
1860
- state : InboundHTLCState :: RemoteAnnounced ( pending_forward_state ) ,
1855
+ state : InboundHTLCState :: RemoteAnnounced ( pending_forward_status ) ,
1861
1856
} ) ;
1862
1857
Ok ( ( ) )
1863
1858
}
0 commit comments