@@ -1766,6 +1766,7 @@ where
1766
1766
.pending_splice
1767
1767
.as_mut()
1768
1768
.and_then(|pending_splice| pending_splice.funding_negotiation.take())
1769
+ .filter(|funding_negotiation| funding_negotiation.is_initiator())
1769
1770
.map(|funding_negotiation| {
1770
1771
let funding = funding_negotiation.as_funding();
1771
1772
SpliceFundingFailed {
@@ -2001,6 +2002,7 @@ where
2001
2002
interactive_tx_constructor,
2002
2003
} = funding_negotiation
2003
2004
{
2005
+ let is_initiator = interactive_tx_constructor.is_initiator();
2004
2006
let signing_session = interactive_tx_constructor.into_signing_session();
2005
2007
let commitment_signed_result = chan.context.funding_tx_constructed(
2006
2008
&mut funding,
@@ -2013,7 +2015,7 @@ where
2013
2015
// This must be set even if returning an Err. Otherwise,
2014
2016
// fail_interactive_tx_negotiation won't produce a SpliceFailed event.
2015
2017
pending_splice.funding_negotiation =
2016
- Some(FundingNegotiation::AwaitingSignatures { funding });
2018
+ Some(FundingNegotiation::AwaitingSignatures { funding, is_initiator });
2017
2019
2018
2020
return commitment_signed_result;
2019
2021
} else {
@@ -2606,12 +2608,14 @@ enum FundingNegotiation {
2606
2608
},
2607
2609
AwaitingSignatures {
2608
2610
funding: FundingScope,
2611
+ is_initiator: bool,
2609
2612
},
2610
2613
}
2611
2614
2612
2615
impl_writeable_tlv_based_enum_upgradable!(FundingNegotiation,
2613
2616
(0, AwaitingSignatures) => {
2614
2617
(1, funding, required),
2618
+ (3, is_initiator, required),
2615
2619
},
2616
2620
unread_variants: AwaitingAck, ConstructingTransaction
2617
2621
);
@@ -2621,7 +2625,17 @@ impl FundingNegotiation {
2621
2625
match self {
2622
2626
FundingNegotiation::AwaitingAck { .. } => None,
2623
2627
FundingNegotiation::ConstructingTransaction { funding, .. } => Some(funding),
2624
- FundingNegotiation::AwaitingSignatures { funding } => Some(funding),
2628
+ FundingNegotiation::AwaitingSignatures { funding, .. } => Some(funding),
2629
+ }
2630
+ }
2631
+
2632
+ fn is_initiator(&self) -> bool {
2633
+ match self {
2634
+ FundingNegotiation::AwaitingAck { context } => context.is_initiator,
2635
+ FundingNegotiation::ConstructingTransaction { interactive_tx_constructor, .. } => {
2636
+ interactive_tx_constructor.is_initiator()
2637
+ },
2638
+ FundingNegotiation::AwaitingSignatures { is_initiator, .. } => *is_initiator,
2625
2639
}
2626
2640
}
2627
2641
}
@@ -8627,7 +8641,7 @@ where
8627
8641
8628
8642
if let Some(pending_splice) = self.pending_splice.as_mut() {
8629
8643
self.context.channel_state.clear_quiescent();
8630
- if let Some(FundingNegotiation::AwaitingSignatures { mut funding }) =
8644
+ if let Some(FundingNegotiation::AwaitingSignatures { mut funding, .. }) =
8631
8645
pending_splice.funding_negotiation.take()
8632
8646
{
8633
8647
funding.funding_transaction = Some(funding_tx);
@@ -9544,7 +9558,7 @@ where
9544
9558
.as_ref()
9545
9559
.and_then(|pending_splice| pending_splice.funding_negotiation.as_ref())
9546
9560
.and_then(|funding_negotiation| {
9547
- if let FundingNegotiation::AwaitingSignatures { funding } = &funding_negotiation {
9561
+ if let FundingNegotiation::AwaitingSignatures { funding, .. } = &funding_negotiation {
9548
9562
Some(funding)
9549
9563
} else {
9550
9564
None
0 commit comments