From 12a3b114ff4e767db537a553fefbcb95d04f347b Mon Sep 17 00:00:00 2001 From: daywalker90 <8257956+daywalker90@users.noreply.github.com> Date: Sat, 23 May 2026 08:55:44 +0200 Subject: [PATCH] CLN balance offer fix and makeoffer fix (#2373) * fix: don't use deprecated balance fields for CLN * fix: add missing amount for makeoffer for CLN --- lnclient/cln/cln.go | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/lnclient/cln/cln.go b/lnclient/cln/cln.go index f7dd1730..acd11a1e 100644 --- a/lnclient/cln/cln.go +++ b/lnclient/cln/cln.go @@ -994,25 +994,25 @@ func (c *CLNService) GetBalances(ctx context.Context, includeInactiveChannels bo if ch.SpendableMsat != nil { spendable := int64(ch.SpendableMsat.Msat) - lightning.TotalSpendable += spendable + lightning.TotalSpendableMsat += spendable - if spendable > lightning.NextMaxSpendable { - lightning.NextMaxSpendable = spendable + if spendable > lightning.NextMaxSpendableMsat { + lightning.NextMaxSpendableMsat = spendable } } if ch.ReceivableMsat != nil { receivable := int64(ch.ReceivableMsat.Msat) - lightning.TotalReceivable += receivable + lightning.TotalReceivableMsat += receivable - if receivable > lightning.NextMaxReceivable { - lightning.NextMaxReceivable = receivable + if receivable > lightning.NextMaxReceivableMsat { + lightning.NextMaxReceivableMsat = receivable } } } - lightning.NextMaxSpendableMPP = lightning.TotalSpendable - lightning.NextMaxReceivableMPP = lightning.TotalReceivable + lightning.NextMaxSpendableMPPMsat = lightning.TotalSpendableMsat + lightning.NextMaxReceivableMPPMsat = lightning.TotalReceivableMsat return &lnclient.BalancesResponse{ Onchain: *onchainBalance, @@ -1274,24 +1274,24 @@ func (c *CLNService) GetOnchainBalance(ctx context.Context) (*lnclient.OnchainBa } amt := satInt64(utxo.AmountMsat) - balances.Total += amt + balances.TotalSat += amt if utxo.Reserved { - balances.Reserved += amt + balances.ReservedSat += amt reservedSats += amt } switch utxo.Status { case clngrpc.ListfundsOutputs_CONFIRMED: if !utxo.Reserved { - balances.Spendable += amt + balances.SpendableSat += amt } case clngrpc.ListfundsOutputs_UNCONFIRMED: balances.PendingSweepBalancesDetails = append( balances.PendingSweepBalancesDetails, lnclient.PendingBalanceDetails{ - Amount: uint64(amt), + AmountSat: uint64(amt), FundingTxId: hex.EncodeToString(utxo.Txid), FundingTxVout: utxo.Output, }, @@ -1305,13 +1305,13 @@ func (c *CLNService) GetOnchainBalance(ctx context.Context) (*lnclient.OnchainBa } amt := sat(ch.OurAmountMsat) - balances.PendingBalancesFromChannelClosures += amt + balances.PendingBalancesFromChannelClosuresSat += amt chanIdStr := hex.EncodeToString(ch.ChannelId) detail := lnclient.PendingBalanceDetails{ ChannelId: chanIdStr, NodeId: hex.EncodeToString(ch.PeerId), - Amount: amt, + AmountSat: amt, } if pc, ok := chByID[chanIdStr]; ok { @@ -2128,6 +2128,7 @@ func (c *CLNService) MakeOffer(ctx context.Context, description string) (string, }).Debug("Make Offer") req := &clngrpc.OfferRequest{ + Amount: "any", Description: &description, } resp, err := c.client.Offer(ctx, req)