@@ -1604,7 +1604,7 @@ impl Channel {
1604
1604
Err ( ChannelError :: Close ( "Remote tried to fulfill/fail an HTLC we couldn't find" ) )
1605
1605
}
1606
1606
1607
- pub fn update_fulfill_htlc ( & mut self , msg : & msgs:: UpdateFulfillHTLC ) -> Result < & HTLCSource , ChannelError > {
1607
+ pub fn update_fulfill_htlc ( & mut self , msg : & msgs:: UpdateFulfillHTLC ) -> Result < HTLCSource , ChannelError > {
1608
1608
if ( self . channel_state & ( ChannelState :: ChannelFunded as u32 ) ) != ( ChannelState :: ChannelFunded as u32 ) {
1609
1609
return Err ( ChannelError :: Close ( "Got fulfill HTLC message when channel was not in an operational state" ) ) ;
1610
1610
}
@@ -1617,29 +1617,31 @@ impl Channel {
1617
1617
let mut payment_hash = [ 0 ; 32 ] ;
1618
1618
sha. result ( & mut payment_hash) ;
1619
1619
1620
- self . mark_outbound_htlc_removed ( msg. htlc_id , Some ( payment_hash) , None )
1620
+ self . mark_outbound_htlc_removed ( msg. htlc_id , Some ( payment_hash) , None ) . map ( |source| source . clone ( ) )
1621
1621
}
1622
1622
1623
- pub fn update_fail_htlc ( & mut self , msg : & msgs:: UpdateFailHTLC , fail_reason : HTLCFailReason ) -> Result < & HTLCSource , ChannelError > {
1623
+ pub fn update_fail_htlc ( & mut self , msg : & msgs:: UpdateFailHTLC , fail_reason : HTLCFailReason ) -> Result < ( ) , ChannelError > {
1624
1624
if ( self . channel_state & ( ChannelState :: ChannelFunded as u32 ) ) != ( ChannelState :: ChannelFunded as u32 ) {
1625
1625
return Err ( ChannelError :: Close ( "Got fail HTLC message when channel was not in an operational state" ) ) ;
1626
1626
}
1627
1627
if self . channel_state & ( ChannelState :: PeerDisconnected as u32 ) == ChannelState :: PeerDisconnected as u32 {
1628
1628
return Err ( ChannelError :: Close ( "Peer sent update_fail_htlc when we needed a channel_reestablish" ) ) ;
1629
1629
}
1630
1630
1631
- self . mark_outbound_htlc_removed ( msg. htlc_id , None , Some ( fail_reason) )
1631
+ self . mark_outbound_htlc_removed ( msg. htlc_id , None , Some ( fail_reason) ) ?;
1632
+ Ok ( ( ) )
1632
1633
}
1633
1634
1634
- pub fn update_fail_malformed_htlc < ' a > ( & mut self , msg : & msgs:: UpdateFailMalformedHTLC , fail_reason : HTLCFailReason ) -> Result < & HTLCSource , ChannelError > {
1635
+ pub fn update_fail_malformed_htlc < ' a > ( & mut self , msg : & msgs:: UpdateFailMalformedHTLC , fail_reason : HTLCFailReason ) -> Result < ( ) , ChannelError > {
1635
1636
if ( self . channel_state & ( ChannelState :: ChannelFunded as u32 ) ) != ( ChannelState :: ChannelFunded as u32 ) {
1636
1637
return Err ( ChannelError :: Close ( "Got fail malformed HTLC message when channel was not in an operational state" ) ) ;
1637
1638
}
1638
1639
if self . channel_state & ( ChannelState :: PeerDisconnected as u32 ) == ChannelState :: PeerDisconnected as u32 {
1639
1640
return Err ( ChannelError :: Close ( "Peer sent update_fail_malformed_htlc when we needed a channel_reestablish" ) ) ;
1640
1641
}
1641
1642
1642
- self . mark_outbound_htlc_removed ( msg. htlc_id , None , Some ( fail_reason) )
1643
+ self . mark_outbound_htlc_removed ( msg. htlc_id , None , Some ( fail_reason) ) ?;
1644
+ Ok ( ( ) )
1643
1645
}
1644
1646
1645
1647
pub fn commitment_signed ( & mut self , msg : & msgs:: CommitmentSigned , fee_estimator : & FeeEstimator ) -> Result < ( msgs:: RevokeAndACK , Option < msgs:: CommitmentSigned > , Option < msgs:: ClosingSigned > , ChannelMonitor ) , ChannelError > {
0 commit comments