mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-22 03:56:44 +01:00
lnrpc: add push amount to listchannels
This commit is contained in:
17
rpcserver.go
17
rpcserver.go
@@ -3195,6 +3195,23 @@ func createRPCOpenChannel(r *rpcServer, graph *channeldb.ChannelGraph,
|
||||
channel.UnsettledBalance += channel.PendingHtlcs[i].Amount
|
||||
}
|
||||
|
||||
// Lookup our balances at height 0, because they will reflect any
|
||||
// push amounts that may have been present when this channel was
|
||||
// created.
|
||||
localBalance, remoteBalance, err := dbChannel.BalancesAtHeight(0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// If we initiated opening the channel, the zero height remote balance
|
||||
// is the push amount. Otherwise, our starting balance is the push
|
||||
// amount. If there is no push amount, these values will simply be zero.
|
||||
if dbChannel.IsInitiator {
|
||||
channel.PushAmountSat = uint64(remoteBalance.ToSatoshis())
|
||||
} else {
|
||||
channel.PushAmountSat = uint64(localBalance.ToSatoshis())
|
||||
}
|
||||
|
||||
outpoint := dbChannel.FundingOutpoint
|
||||
|
||||
// Get the lifespan observed by the channel event store. If the channel is
|
||||
|
||||
Reference in New Issue
Block a user