@@ -1734,6 +1734,7 @@ where
1734
1734
.pending_splice
1735
1735
.as_mut()
1736
1736
.and_then(|pending_splice| pending_splice.funding_negotiation.take())
1737
+ .filter(|funding_negotiation| funding_negotiation.is_initiator())
1737
1738
.map(|funding_negotiation| {
1738
1739
let funding = funding_negotiation.as_funding();
1739
1740
SpliceFundingFailed {
@@ -1989,6 +1990,7 @@ where
1989
1990
interactive_tx_constructor,
1990
1991
} = funding_negotiation
1991
1992
{
1993
+ let is_initiator = interactive_tx_constructor.is_initiator();
1992
1994
let signing_session = interactive_tx_constructor.into_signing_session();
1993
1995
let commitment_signed = chan.context.funding_tx_constructed(
1994
1996
&mut funding,
@@ -1999,7 +2001,7 @@ where
1999
2001
)?;
2000
2002
2001
2003
pending_splice.funding_negotiation =
2002
- Some(FundingNegotiation::AwaitingSignatures { funding });
2004
+ Some(FundingNegotiation::AwaitingSignatures { funding, is_initiator });
2003
2005
2004
2006
return Ok(commitment_signed);
2005
2007
} else {
@@ -2600,12 +2602,14 @@ enum FundingNegotiation {
2600
2602
},
2601
2603
AwaitingSignatures {
2602
2604
funding: FundingScope,
2605
+ is_initiator: bool,
2603
2606
},
2604
2607
}
2605
2608
2606
2609
impl_writeable_tlv_based_enum_upgradable!(FundingNegotiation,
2607
2610
(0, AwaitingSignatures) => {
2608
2611
(1, funding, required),
2612
+ (3, is_initiator, required),
2609
2613
},
2610
2614
unread_variants: AwaitingAck, ConstructingTransaction
2611
2615
);
@@ -2615,7 +2619,17 @@ impl FundingNegotiation {
2615
2619
match self {
2616
2620
FundingNegotiation::AwaitingAck { .. } => None,
2617
2621
FundingNegotiation::ConstructingTransaction { funding, .. } => Some(funding),
2618
- FundingNegotiation::AwaitingSignatures { funding } => Some(funding),
2622
+ FundingNegotiation::AwaitingSignatures { funding, .. } => Some(funding),
2623
+ }
2624
+ }
2625
+
2626
+ fn is_initiator(&self) -> bool {
2627
+ match self {
2628
+ FundingNegotiation::AwaitingAck { context } => context.is_initiator,
2629
+ FundingNegotiation::ConstructingTransaction { interactive_tx_constructor, .. } => {
2630
+ interactive_tx_constructor.is_initiator()
2631
+ },
2632
+ FundingNegotiation::AwaitingSignatures { is_initiator, .. } => *is_initiator,
2619
2633
}
2620
2634
}
2621
2635
}
@@ -8672,7 +8686,7 @@ where
8672
8686
8673
8687
if let Some(pending_splice) = self.pending_splice.as_mut() {
8674
8688
self.context.channel_state.clear_quiescent();
8675
- if let Some(FundingNegotiation::AwaitingSignatures { mut funding }) =
8689
+ if let Some(FundingNegotiation::AwaitingSignatures { mut funding, .. }) =
8676
8690
pending_splice.funding_negotiation.take()
8677
8691
{
8678
8692
funding.funding_transaction = Some(funding_tx);
@@ -9589,7 +9603,7 @@ where
9589
9603
.as_ref()
9590
9604
.and_then(|pending_splice| pending_splice.funding_negotiation.as_ref())
9591
9605
.and_then(|funding_negotiation| {
9592
- if let FundingNegotiation::AwaitingSignatures { funding } = &funding_negotiation {
9606
+ if let FundingNegotiation::AwaitingSignatures { funding, .. } = &funding_negotiation {
9593
9607
Some(funding)
9594
9608
} else {
9595
9609
None
0 commit comments