@@ -10944,6 +10944,8 @@ where
10944
10944
)));
10945
10945
}
10946
10946
10947
+ // TODO(splicing): Once splice acceptor can contribute, check that inputs are sufficient,
10948
+ // similarly to the check in `splice_channel`.
10947
10949
debug_assert_eq!(our_funding_contribution, SignedAmount::ZERO);
10948
10950
10949
10951
// TODO(splicing): Move this check once user-provided contributions are supported for
@@ -10965,33 +10967,18 @@ where
10965
10967
}
10966
10968
10967
10969
let their_funding_contribution = SignedAmount::from_sat(msg.funding_contribution_satoshis);
10968
- self.validate_splice_contribution(their_funding_contribution)?;
10969
-
10970
- // TODO(splicing): Check that channel balance does not go below the channel reserve
10971
-
10972
- let splice_funding = FundingScope::for_splice(
10973
- &self.funding,
10974
- &self.context,
10970
+ self.validate_splice_contribution(
10975
10971
our_funding_contribution,
10976
10972
their_funding_contribution,
10977
10973
msg.funding_pubkey,
10978
- );
10979
-
10980
- // TODO(splicing): Once splice acceptor can contribute, check that inputs are sufficient,
10981
- // similarly to the check in `splice_channel`.
10982
-
10983
- // Note on channel reserve requirement pre-check: as the splice acceptor does not contribute,
10984
- // it can't go below reserve, therefore no pre-check is done here.
10985
-
10986
- // TODO(splicing): Early check for reserve requirement
10987
-
10988
- Ok(splice_funding)
10974
+ )
10989
10975
}
10990
10976
10991
10977
#[cfg(splicing)]
10992
10978
fn validate_splice_contribution(
10993
- &self, their_funding_contribution: SignedAmount,
10994
- ) -> Result<(), ChannelError> {
10979
+ &self, our_funding_contribution: SignedAmount, their_funding_contribution: SignedAmount,
10980
+ counterparty_funding_pubkey: PublicKey,
10981
+ ) -> Result<FundingScope, ChannelError> {
10995
10982
if their_funding_contribution > SignedAmount::MAX_MONEY {
10996
10983
return Err(ChannelError::WarnAndDisconnect(format!(
10997
10984
"Channel {} cannot be spliced in; their {} contribution exceeds the total bitcoin supply",
@@ -11024,7 +11011,25 @@ where
11024
11011
)));
11025
11012
}
11026
11013
11027
- Ok(())
11014
+ let splice_funding = FundingScope::for_splice(
11015
+ &self.funding,
11016
+ &self.context,
11017
+ our_funding_contribution,
11018
+ their_funding_contribution,
11019
+ counterparty_funding_pubkey,
11020
+ );
11021
+
11022
+ // TODO(splicing): Check that channel balance does not go below the channel reserve
11023
+
11024
+ // Note on channel reserve requirement pre-check: as the splice acceptor does not contribute,
11025
+ // it can't go below reserve, therefore no pre-check is done here.
11026
+
11027
+ // TODO(splicing): Early check for reserve requirement
11028
+
11029
+ // TODO(splicing): Pre-check for reserve requirement
11030
+ // (Note: It should also be checked later at tx_complete)
11031
+
11032
+ Ok(splice_funding)
11028
11033
}
11029
11034
11030
11035
#[cfg(splicing)]
@@ -11179,20 +11184,11 @@ where
11179
11184
debug_assert!(our_funding_contribution.abs() <= SignedAmount::MAX_MONEY);
11180
11185
11181
11186
let their_funding_contribution = SignedAmount::from_sat(msg.funding_contribution_satoshis);
11182
- self.validate_splice_contribution(their_funding_contribution)?;
11183
-
11184
- let splice_funding = FundingScope::for_splice(
11185
- &self.funding,
11186
- &self.context,
11187
+ self.validate_splice_contribution(
11187
11188
our_funding_contribution,
11188
11189
their_funding_contribution,
11189
11190
msg.funding_pubkey,
11190
- );
11191
-
11192
- // TODO(splicing): Pre-check for reserve requirement
11193
- // (Note: It should also be checked later at tx_complete)
11194
-
11195
- Ok(splice_funding)
11191
+ )
11196
11192
}
11197
11193
11198
11194
#[cfg(splicing)]
0 commit comments