@@ -1749,10 +1749,10 @@ where
1749
1749
.as_mut()
1750
1750
.and_then(|pending_splice| pending_splice.funding_negotiation.take())
1751
1751
.and_then(|funding_negotiation| {
1752
- if let FundingNegotiation::ConstructingTransaction(
1753
- _,
1752
+ if let FundingNegotiation::ConstructingTransaction {
1754
1753
interactive_tx_constructor,
1755
- ) = funding_negotiation
1754
+ ..
1755
+ } = funding_negotiation
1756
1756
{
1757
1757
Some(interactive_tx_constructor)
1758
1758
} else {
@@ -1970,10 +1970,10 @@ where
1970
1970
ChannelPhase::Funded(chan) => {
1971
1971
if let Some(pending_splice) = chan.pending_splice.as_mut() {
1972
1972
if let Some(funding_negotiation) = pending_splice.funding_negotiation.take() {
1973
- if let FundingNegotiation::ConstructingTransaction(
1973
+ if let FundingNegotiation::ConstructingTransaction {
1974
1974
mut funding,
1975
1975
interactive_tx_constructor,
1976
- ) = funding_negotiation
1976
+ } = funding_negotiation
1977
1977
{
1978
1978
let mut signing_session =
1979
1979
interactive_tx_constructor.into_signing_session();
@@ -1987,7 +1987,7 @@ where
1987
1987
1988
1988
chan.interactive_tx_signing_session = Some(signing_session);
1989
1989
pending_splice.funding_negotiation =
1990
- Some(FundingNegotiation::AwaitingSignatures( funding) );
1990
+ Some(FundingNegotiation::AwaitingSignatures { funding } );
1991
1991
1992
1992
return Ok(commitment_signed);
1993
1993
} else {
@@ -2058,7 +2058,7 @@ where
2058
2058
let has_negotiated_pending_splice = funded_channel.pending_splice.as_ref()
2059
2059
.and_then(|pending_splice| pending_splice.funding_negotiation.as_ref())
2060
2060
.filter(|funding_negotiation| {
2061
- matches!(funding_negotiation, FundingNegotiation::AwaitingSignatures(_) )
2061
+ matches!(funding_negotiation, FundingNegotiation::AwaitingSignatures { .. } )
2062
2062
})
2063
2063
.map(|funding_negotiation| funding_negotiation.as_funding().is_some())
2064
2064
.unwrap_or(false);
@@ -2564,17 +2564,24 @@ struct PendingFunding {
2564
2564
}
2565
2565
2566
2566
enum FundingNegotiation {
2567
- AwaitingAck(FundingNegotiationContext),
2568
- ConstructingTransaction(FundingScope, InteractiveTxConstructor),
2569
- AwaitingSignatures(FundingScope),
2567
+ AwaitingAck {
2568
+ context: FundingNegotiationContext,
2569
+ },
2570
+ ConstructingTransaction {
2571
+ funding: FundingScope,
2572
+ interactive_tx_constructor: InteractiveTxConstructor,
2573
+ },
2574
+ AwaitingSignatures {
2575
+ funding: FundingScope,
2576
+ },
2570
2577
}
2571
2578
2572
2579
impl FundingNegotiation {
2573
2580
fn as_funding(&self) -> Option<&FundingScope> {
2574
2581
match self {
2575
- FundingNegotiation::AwaitingAck(_) => None,
2576
- FundingNegotiation::ConstructingTransaction( funding, _) => Some(funding),
2577
- FundingNegotiation::AwaitingSignatures( funding) => Some(funding),
2582
+ FundingNegotiation::AwaitingAck { .. } => None,
2583
+ FundingNegotiation::ConstructingTransaction { funding, .. } => Some(funding),
2584
+ FundingNegotiation::AwaitingSignatures { funding } => Some(funding),
2578
2585
}
2579
2586
}
2580
2587
}
@@ -6760,8 +6767,10 @@ where
6760
6767
.as_mut()
6761
6768
.and_then(|pending_splice| pending_splice.funding_negotiation.as_mut())
6762
6769
.and_then(|funding_negotiation| {
6763
- if let FundingNegotiation::ConstructingTransaction(_, interactive_tx_constructor) =
6764
- funding_negotiation
6770
+ if let FundingNegotiation::ConstructingTransaction {
6771
+ interactive_tx_constructor,
6772
+ ..
6773
+ } = funding_negotiation
6765
6774
{
6766
6775
Some(interactive_tx_constructor)
6767
6776
} else {
@@ -7580,7 +7589,7 @@ where
7580
7589
.as_ref()
7581
7590
.and_then(|pending_splice| pending_splice.funding_negotiation.as_ref())
7582
7591
.filter(|funding_negotiation| {
7583
- matches!(funding_negotiation, FundingNegotiation::AwaitingSignatures(_) )
7592
+ matches!(funding_negotiation, FundingNegotiation::AwaitingSignatures { .. } )
7584
7593
})
7585
7594
.and_then(|funding_negotiation| funding_negotiation.as_funding())
7586
7595
.expect("Funding must exist for negotiated pending splice");
@@ -8571,7 +8580,7 @@ where
8571
8580
.funding_negotiation
8572
8581
.as_ref()
8573
8582
.map(|funding_negotiation| {
8574
- matches!(funding_negotiation, FundingNegotiation::AwaitingSignatures(_) )
8583
+ matches!(funding_negotiation, FundingNegotiation::AwaitingSignatures { .. } )
8575
8584
})
8576
8585
.unwrap_or(false)
8577
8586
{
@@ -9435,7 +9444,7 @@ where
9435
9444
.as_ref()
9436
9445
.and_then(|pending_splice| pending_splice.funding_negotiation.as_ref())
9437
9446
.and_then(|funding_negotiation| {
9438
- if let FundingNegotiation::AwaitingSignatures( funding) = &funding_negotiation {
9447
+ if let FundingNegotiation::AwaitingSignatures { funding } = &funding_negotiation {
9439
9448
Some(funding)
9440
9449
} else {
9441
9450
None
@@ -11515,7 +11524,7 @@ where
11515
11524
}
11516
11525
11517
11526
let prev_funding_input = self.funding.to_splice_funding_input();
11518
- let funding_negotiation_context = FundingNegotiationContext {
11527
+ let context = FundingNegotiationContext {
11519
11528
is_initiator: true,
11520
11529
our_funding_contribution: adjusted_funding_contribution,
11521
11530
funding_tx_locktime: LockTime::from_consensus(locktime),
@@ -11527,7 +11536,7 @@ where
11527
11536
};
11528
11537
11529
11538
self.pending_splice = Some(PendingFunding {
11530
- funding_negotiation: Some(FundingNegotiation::AwaitingAck(funding_negotiation_context) ),
11539
+ funding_negotiation: Some(FundingNegotiation::AwaitingAck { context } ),
11531
11540
negotiated_candidates: vec![],
11532
11541
sent_funding_txid: None,
11533
11542
received_funding_txid: None,
@@ -11747,10 +11756,10 @@ where
11747
11756
let funding_pubkey = splice_funding.get_holder_pubkeys().funding_pubkey;
11748
11757
11749
11758
self.pending_splice = Some(PendingFunding {
11750
- funding_negotiation: Some(FundingNegotiation::ConstructingTransaction(
11751
- splice_funding,
11759
+ funding_negotiation: Some(FundingNegotiation::ConstructingTransaction {
11760
+ funding: splice_funding,
11752
11761
interactive_tx_constructor,
11753
- ) ),
11762
+ } ),
11754
11763
negotiated_candidates: Vec::new(),
11755
11764
received_funding_txid: None,
11756
11765
sent_funding_txid: None,
@@ -11785,7 +11794,7 @@ where
11785
11794
let pending_splice =
11786
11795
self.pending_splice.as_mut().expect("We should have returned an error earlier!");
11787
11796
// TODO: Good candidate for a let else statement once MSRV >= 1.65
11788
- let funding_negotiation_context = if let Some(FundingNegotiation::AwaitingAck( context) ) =
11797
+ let funding_negotiation_context = if let Some(FundingNegotiation::AwaitingAck { context } ) =
11789
11798
pending_splice.funding_negotiation.take()
11790
11799
{
11791
11800
context
@@ -11811,10 +11820,10 @@ where
11811
11820
11812
11821
debug_assert!(self.interactive_tx_signing_session.is_none());
11813
11822
11814
- pending_splice.funding_negotiation = Some(FundingNegotiation::ConstructingTransaction(
11815
- splice_funding,
11823
+ pending_splice.funding_negotiation = Some(FundingNegotiation::ConstructingTransaction {
11824
+ funding: splice_funding,
11816
11825
interactive_tx_constructor,
11817
- ) );
11826
+ } );
11818
11827
11819
11828
Ok(tx_msg_opt)
11820
11829
}
@@ -11828,9 +11837,9 @@ where
11828
11837
.ok_or(ChannelError::Ignore("Channel is not in pending splice".to_owned()))?
11829
11838
.funding_negotiation
11830
11839
{
11831
- Some(FundingNegotiation::AwaitingAck( context) ) => context,
11832
- Some(FundingNegotiation::ConstructingTransaction(_, _) )
11833
- | Some(FundingNegotiation::AwaitingSignatures(_) ) => {
11840
+ Some(FundingNegotiation::AwaitingAck { context } ) => context,
11841
+ Some(FundingNegotiation::ConstructingTransaction { .. } )
11842
+ | Some(FundingNegotiation::AwaitingSignatures { .. } ) => {
11834
11843
return Err(ChannelError::WarnAndDisconnect(
11835
11844
"Got unexpected splice_ack; splice negotiation already in progress".to_owned(),
11836
11845
));
0 commit comments