rpcserver: print unconfirmed balance, add TODO for racy balance

This commit is contained in:
Johan T. Halseth 2019-05-24 14:17:48 +02:00
parent 6e3b92b55f
commit 1788fa1566
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -2099,6 +2099,8 @@ func (r *rpcServer) WalletBalance(ctx context.Context,
}
// Get confirmed balance, from txs that have >= 1 confirmations.
// TODO(halseth): get both unconfirmed and confirmed balance in one
// call, as this is racy.
confirmedBal, err := r.server.cc.wallet.ConfirmedBalance(1)
if err != nil {
return nil, err
@ -2107,7 +2109,8 @@ func (r *rpcServer) WalletBalance(ctx context.Context,
// Get unconfirmed balance, from txs with 0 confirmations.
unconfirmedBal := totalBal - confirmedBal
rpcsLog.Debugf("[walletbalance] Total balance=%v", totalBal)
rpcsLog.Debugf("[walletbalance] Total balance=%v (confirmed=%v, "+
"unconfirmed=%v)", totalBal, confirmedBal, unconfirmedBal)
return &lnrpc.WalletBalanceResponse{
TotalBalance: int64(totalBal),