@@ -2253,10 +2253,9 @@ impl FundingScope {
2253
2253
their_funding_contribution_sats,
2254
2254
);
2255
2255
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);
2260
2259
debug_assert!(post_value_to_self_msat.is_some());
2261
2260
let post_value_to_self_msat = post_value_to_self_msat.unwrap();
2262
2261
@@ -2323,8 +2322,7 @@ impl FundingScope {
2323
2322
pub(super) fn compute_post_splice_value(
2324
2323
&self, our_funding_contribution: i64, their_funding_contribution: i64,
2325
2324
) -> u64 {
2326
- AddSigned::saturating_add_signed(
2327
- self.get_value_satoshis(),
2325
+ self.get_value_satoshis().saturating_add_signed(
2328
2326
our_funding_contribution.saturating_add(their_funding_contribution),
2329
2327
)
2330
2328
}
@@ -2351,32 +2349,6 @@ impl FundingScope {
2351
2349
}
2352
2350
}
2353
2351
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
-
2380
2352
/// Info about a pending splice
2381
2353
#[cfg(splicing)]
2382
2354
struct PendingSplice {
0 commit comments