This repository was archived by the owner on Feb 3, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -571,7 +571,7 @@ impl<S: MutinyStorage> FederationClient<S> {
571
571
}
572
572
}
573
573
} ;
574
- inv. fees_paid = Some ( outgoing_payment. fee . sats_round_down ( ) ) ;
574
+ inv. fees_paid = Some ( sats_round_up ( & outgoing_payment. fee ) ) ;
575
575
576
576
self . maybe_update_after_checking_fedimint ( inv. clone ( ) )
577
577
. await ?;
@@ -617,6 +617,10 @@ impl<S: MutinyStorage> FederationClient<S> {
617
617
}
618
618
}
619
619
620
+ fn sats_round_up ( amount : & Amount ) -> u64 {
621
+ Amount :: from_msats ( amount. msats + 999 ) . sats_round_down ( )
622
+ }
623
+
620
624
// Get a preferred gateway from a federation
621
625
fn get_gateway_preference (
622
626
gateways : Vec < fedimint_ln_common:: LightningGatewayAnnouncement > ,
Original file line number Diff line number Diff line change @@ -1232,6 +1232,7 @@ impl<S: MutinyStorage> MutinyWallet<S> {
1232
1232
) ;
1233
1233
1234
1234
let fees = fedimint_client. gateway_fee ( ) . await ?;
1235
+ // FIXME: this is still producing off by one. check round down
1235
1236
let amt = max_spendable_amount ( current_balance, & fees)
1236
1237
. map_or ( Err ( MutinyError :: InsufficientBalance ) , Ok ) ?;
1237
1238
log_debug ! ( self . logger, "max spendable: {}" , amt) ;
@@ -1276,9 +1277,10 @@ impl<S: MutinyStorage> MutinyWallet<S> {
1276
1277
) ;
1277
1278
}
1278
1279
1280
+ let total_fees = first_invoice_res. fees_paid . unwrap_or ( 0 ) + fee;
1279
1281
Ok ( FedimintSweepResult {
1280
- amount : first_invoice_amount ,
1281
- fees : Some ( first_invoice_res . fees_paid . unwrap_or ( 0 ) + fee ) ,
1282
+ amount : current_balance - total_fees ,
1283
+ fees : Some ( total_fees ) ,
1282
1284
} )
1283
1285
}
1284
1286
You can’t perform that action at this time.
0 commit comments