rpcserver: print unconfirmed balance, add TODO for racy balance
This commit is contained in:
parent
6e3b92b55f
commit
1788fa1566
@ -2099,6 +2099,8 @@ func (r *rpcServer) WalletBalance(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get confirmed balance, from txs that have >= 1 confirmations.
|
// 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)
|
confirmedBal, err := r.server.cc.wallet.ConfirmedBalance(1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -2107,7 +2109,8 @@ func (r *rpcServer) WalletBalance(ctx context.Context,
|
|||||||
// Get unconfirmed balance, from txs with 0 confirmations.
|
// Get unconfirmed balance, from txs with 0 confirmations.
|
||||||
unconfirmedBal := totalBal - confirmedBal
|
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{
|
return &lnrpc.WalletBalanceResponse{
|
||||||
TotalBalance: int64(totalBal),
|
TotalBalance: int64(totalBal),
|
||||||
|
Loading…
Reference in New Issue
Block a user