@@ -2253,10 +2253,9 @@ impl FundingScope {
22532253 their_funding_contribution_sats,
22542254 );
22552255
2256- let post_value_to_self_msat = AddSigned::checked_add_signed(
2257- prev_funding.value_to_self_msat,
2258- our_funding_contribution_sats * 1000,
2259- );
2256+ let post_value_to_self_msat = prev_funding
2257+ .value_to_self_msat
2258+ .checked_add_signed(our_funding_contribution_sats * 1000);
22602259 debug_assert!(post_value_to_self_msat.is_some());
22612260 let post_value_to_self_msat = post_value_to_self_msat.unwrap();
22622261
@@ -2323,8 +2322,7 @@ impl FundingScope {
23232322 pub(super) fn compute_post_splice_value(
23242323 &self, our_funding_contribution: i64, their_funding_contribution: i64,
23252324 ) -> u64 {
2326- AddSigned::saturating_add_signed(
2327- self.get_value_satoshis(),
2325+ self.get_value_satoshis().saturating_add_signed(
23282326 our_funding_contribution.saturating_add(their_funding_contribution),
23292327 )
23302328 }
@@ -2351,32 +2349,6 @@ impl FundingScope {
23512349 }
23522350}
23532351
2354- // TODO: Remove once MSRV is at least 1.66
2355- #[cfg(splicing)]
2356- trait AddSigned {
2357- fn checked_add_signed(self, rhs: i64) -> Option<u64>;
2358- fn saturating_add_signed(self, rhs: i64) -> u64;
2359- }
2360-
2361- #[cfg(splicing)]
2362- impl AddSigned for u64 {
2363- fn checked_add_signed(self, rhs: i64) -> Option<u64> {
2364- if rhs >= 0 {
2365- self.checked_add(rhs as u64)
2366- } else {
2367- self.checked_sub(rhs.unsigned_abs())
2368- }
2369- }
2370-
2371- fn saturating_add_signed(self, rhs: i64) -> u64 {
2372- if rhs >= 0 {
2373- self.saturating_add(rhs as u64)
2374- } else {
2375- self.saturating_sub(rhs.unsigned_abs())
2376- }
2377- }
2378- }
2379-
23802352/// Info about a pending splice
23812353#[cfg(splicing)]
23822354struct PendingSplice {
0 commit comments