@@ -1227,7 +1227,7 @@ impl<S: MutinyStorage> MutinyWallet<S> {
1227
1227
1228
1228
// If no amount, figure out the amount to send over
1229
1229
let current_balance = fedimint_client. get_balance ( ) . await ?;
1230
- log_info ! (
1230
+ log_debug ! (
1231
1231
self . logger,
1232
1232
"current fedimint client balance: {}" ,
1233
1233
current_balance
@@ -1269,46 +1269,15 @@ impl<S: MutinyStorage> MutinyWallet<S> {
1269
1269
. await ?;
1270
1270
final_result. fees = first_invoice_res. fees_paid ;
1271
1271
1272
- // pay_invoice returns invoice if Succeeded or Err if something else
1273
- // it's safe to assume that it went through and we can check remaining balance
1274
1272
let remaining_balance = fedimint_client. get_balance ( ) . await ?;
1275
- log_debug ! (
1276
- self . logger,
1277
- "remaining fedimint balance: {}" ,
1278
- remaining_balance
1279
- ) ;
1280
- if remaining_balance > 1 {
1281
- // the fee for existing channel is voltage 1 sat + base fee + ppm
1282
- let remaining_balance_minus_fee = max_spendable_amount ( remaining_balance - 1 , fees) ;
1283
- if remaining_balance_minus_fee. is_none ( ) {
1284
- return Ok ( final_result) ;
1285
- }
1286
- let remaining_balance_minus_fee = remaining_balance_minus_fee. unwrap ( ) ;
1287
-
1288
- let inv = self
1289
- . node_manager
1290
- . create_invoice ( remaining_balance_minus_fee)
1291
- . await ?;
1292
-
1293
- match fedimint_client
1294
- . pay_invoice ( inv. bolt11 . expect ( "create inv had one job" ) , vec ! [ ] )
1295
- . await
1296
- {
1297
- Ok ( r) => {
1298
- log_debug ! ( self . logger, "paid remaining balance" ) ;
1299
- final_result. amount += remaining_balance_minus_fee;
1300
- final_result. fees = final_result. fees . map_or ( r. fees_paid , |val| {
1301
- r. fees_paid
1302
- . map ( |add_val| val + add_val)
1303
- . map_or ( Some ( val) , |_| None )
1304
- } ) ;
1305
- }
1306
- Err ( e) => {
1307
- // Don't want to return this error since it's just "incomplete",
1308
- // and just not the full amount.
1309
- log_warn ! ( self . logger, "error paying remaining balance: {}" , e)
1310
- }
1311
- }
1273
+ if remaining_balance > 0 {
1274
+ // there was a remainder when there shouldn't have been
1275
+ // for now just log this, it is probably just a millisat/1 sat difference
1276
+ log_warn ! (
1277
+ self . logger,
1278
+ "remaining fedimint balance: {}" ,
1279
+ remaining_balance
1280
+ ) ;
1312
1281
}
1313
1282
1314
1283
Ok ( final_result)
0 commit comments