@@ -1259,9 +1259,9 @@ impl<SP: Deref> Channel<SP> where
12591259 ChannelPhase::Funded(_) => { debug_assert!(false); None }
12601260 #[cfg(splicing)]
12611261 ChannelPhase::Funded(chan) => {
1262- chan.pending_splice.as_mut().map (|splice|
1262+ chan.pending_splice.as_mut().and_then (|splice|
12631263 splice.refunding_scope.as_mut().map(|refunding_scope| &mut refunding_scope.pending_unfunded_context)
1264- ).flatten()
1264+ )
12651265 }
12661266 ChannelPhase::UnfundedOutboundV1(chan) => Some(&mut chan.unfunded_context),
12671267 ChannelPhase::UnfundedInboundV1(chan) => Some(&mut chan.unfunded_context),
@@ -2431,66 +2431,66 @@ impl<SP: Deref> InitialRemoteCommitmentReceiver<SP> for FundedChannel<SP> where
24312431impl<SP: Deref> FundingTxConstructorV2<SP> for FundedChannel<SP> where SP::Target: SignerProvider {
24322432 #[inline]
24332433 fn pending_funding(&self) -> Result<&FundingScope, &'static str> {
2434- self.pending_splice.as_ref().map (|splice|
2434+ self.pending_splice.as_ref().and_then (|splice|
24352435 splice.refunding_scope.as_ref().map(|refunding| &refunding.pending_funding)
2436- ).flatten(). ok_or("Not re-funding")
2436+ ).ok_or("Not re-funding")
24372437 }
24382438
24392439 #[inline]
24402440 fn pending_funding_mut(&mut self) -> Result<&mut FundingScope, &'static str> {
2441- self.pending_splice.as_mut().map (|splice|
2441+ self.pending_splice.as_mut().and_then (|splice|
24422442 splice.refunding_scope.as_mut().map(|refunding| &mut refunding.pending_funding)
2443- ).flatten(). ok_or("Not re-funding")
2443+ ).ok_or("Not re-funding")
24442444 }
24452445
24462446 #[inline]
24472447 fn pending_funding_and_context_mut(&mut self) -> Result<(&FundingScope, &mut ChannelContext<SP>), &'static str> {
24482448 let context_mut = &mut self.context;
2449- self.pending_splice.as_ref().map (|splice|
2449+ self.pending_splice.as_ref().and_then (|splice|
24502450 splice.refunding_scope.as_ref().map(|refunding| (&refunding.pending_funding, context_mut))
2451- ).flatten(). ok_or("Not re-funding")
2451+ ).ok_or("Not re-funding")
24522452 }
24532453
24542454 #[inline]
24552455 fn dual_funding_context(&self) -> Result<&DualFundingChannelContext, &'static str> {
2456- self.pending_splice.as_ref().map (|splice|
2456+ self.pending_splice.as_ref().and_then (|splice|
24572457 splice.refunding_scope.as_ref().map(|refunding| &refunding.pending_dual_funding_context)
2458- ).flatten(). ok_or("Not re-funding")
2458+ ).ok_or("Not re-funding")
24592459 }
24602460
24612461 #[inline]
24622462 fn dual_funding_context_mut(&mut self) -> Result<&mut DualFundingChannelContext, &'static str> {
2463- self.pending_splice.as_mut().map (|splice|
2463+ self.pending_splice.as_mut().and_then (|splice|
24642464 splice.refunding_scope.as_mut().map(|refunding| &mut refunding.pending_dual_funding_context)
2465- ).flatten(). ok_or("Not re-funding")
2465+ ).ok_or("Not re-funding")
24662466 }
24672467
24682468 #[inline]
24692469 fn unfunded_context(&self) -> Result<&UnfundedChannelContext, &'static str> {
2470- self.pending_splice.as_ref().map (|splice|
2470+ self.pending_splice.as_ref().and_then (|splice|
24712471 splice.refunding_scope.as_ref().map(|refunding| &refunding.pending_unfunded_context)
2472- ).flatten(). ok_or("Not re-funding")
2472+ ).ok_or("Not re-funding")
24732473 }
24742474
24752475 #[inline]
24762476 fn interactive_tx_constructor(&self) -> Result<Option<&InteractiveTxConstructor>, &'static str> {
2477- self.pending_splice.as_ref().map (|splice|
2477+ self.pending_splice.as_ref().and_then (|splice|
24782478 splice.refunding_scope.as_ref().map(|refunding| refunding.pending_interactive_tx_constructor.as_ref())
2479- ).flatten(). ok_or("Not re-funding")
2479+ ).ok_or("Not re-funding")
24802480 }
24812481
24822482 #[inline]
24832483 fn interactive_tx_constructor_mut(&mut self) -> Result<&mut Option<InteractiveTxConstructor>, &'static str> {
2484- self.pending_splice.as_mut().map (|splice|
2484+ self.pending_splice.as_mut().and_then (|splice|
24852485 splice.refunding_scope.as_mut().map(|refunding| &mut refunding.pending_interactive_tx_constructor)
2486- ).flatten(). ok_or("Not re-funding")
2486+ ).ok_or("Not re-funding")
24872487 }
24882488
24892489 #[inline]
24902490 fn interactive_tx_signing_session_mut(&mut self) -> Result<&mut Option<InteractiveTxSigningSession>, &'static str> {
2491- self.pending_splice.as_mut().map (|splice|
2491+ self.pending_splice.as_mut().and_then (|splice|
24922492 splice.refunding_scope.as_mut().map(|refunding| &mut refunding.pending_interactive_tx_signing_session)
2493- ).flatten(). ok_or("Not re-funding")
2493+ ).ok_or("Not re-funding")
24942494 }
24952495}
24962496
0 commit comments